Package Exports
- mdast-util-compact
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mdast-util-compact) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mdast-util-compact

Make an MDAST tree compact: collapse text nodes (when possible), and blockquotes (in commonmark mode).
Installation
npm:
npm install mdast-util-compact
Usage
var u = require('unist-builder');
var compact = require('mdast-util-compact');
var tree = u('strong', [
u('text', 'alpha'),
u('text', ' '),
u('text', 'bravo')
]);
compact(tree);
console.log(tree);
Yields:
{ type: 'strong',
children: [ { type: 'text', value: 'alpha bravo' } ] }
API
compact(tree[, commonmark])
Visit the tree and collapse nodes. Combines adjacent text nodes (but
not when they represent entities or escapes). If commonmark
is true
,
collapses blockquote
nodes.
Handles positional information properly.
Returns
The given tree
.