mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 09:47:56 +08:00
DISABLE_THIRD_PARTY_CHECK=updating node_modules deps Change-Id: I37d4670cf18e26e8caa8a5b1ca19c8f187244bac Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2259851 Commit-Queue: Mathias Bynens <mathias@chromium.org> Auto-Submit: Mathias Bynens <mathias@chromium.org> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
mdast-util-compact
mdast utility to make trees compact: collapse text nodes (when possible) and blockquotes (in commonmark mode).
Install
npm:
npm install mdast-util-compact
Use
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])
Walk the tree and collapse nodes.
Combines adjacent texts (but not when they represent entities or escapes).
If commonmark is true, collapses blockquotes.
Handles positional information properly.
Returns
The given tree.
Security
Use of mdast-util-compact does not involve hast or user content
so there are no openings for cross-site scripting (XSS) attacks.
Contribute
See contributing.md in syntax-tree/.github for ways to get
started.
See support.md for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.