
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
mdast-squeeze-paragraphs
Advanced tools
mdast utility to remove empty paragraphs.
This package is a utility that removes empty paragraphs, left over from other operations, from the tree. Paragraphs are considered empty if they do not contain non-whitespace characters.
Probably never! You should try to clean your trees yourself.
A plugin, remark-squeeze-paragraphs
, exists that
does the same but for remark.
This package is ESM only. In Node.js (version 16+), install with npm:
npm install mdast-squeeze-paragraphs
In Deno with esm.sh
:
import {squeezeParagraphs} from 'https://esm.sh/mdast-squeeze-paragraphs@6'
In browsers with esm.sh
:
<script type="module">
import {squeezeParagraphs} from 'https://esm.sh/mdast-squeeze-paragraphs@6?bundle'
</script>
import {squeezeParagraphs} from 'mdast-squeeze-paragraphs'
import {u} from 'unist-builder'
const tree = u('root', [
u('paragraph', []),
u('paragraph', [u('text', 'Alpha')]),
u('paragraph', [u('text', ' ')])
])
squeezeParagraphs(tree)
console.dir(tree, {depth: null})
Yields:
{ type: 'root',
children:
[ { type: 'paragraph',
children: [ { type: 'text', value: 'Alpha' } ] } ] }
This package exports the identifier
squeezeParagraphs
.
There is no default export.
squeezeParagraphs(tree)
Remove empty paragraphs in tree
.
tree
(Node
)
— tree to changeNothing (undefined
).
This package is fully typed with TypeScript. It exports no additional types..
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
mdast-squeeze-paragraphs@^6
, compatible with Node.js 16.
Use of mdast-squeeze-paragraphs
does not involve hast or user content
so there are no openings for cross-site scripting (XSS) attacks.
remark-squeeze-paragraphs
— remark pluginmdast-util-compact
— make a tree compactSee 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.
MIT © Eugene Sharygin
FAQs
mdast utility to remove empty paragraphs from a tree
We found that mdast-squeeze-paragraphs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.