mdast-squeeze-paragraphs
Remove empty paragraphs and whitespace left from other mdast transformations.
Paragraph is considered empty if it is composed from whitespace characters.
This module provides both AST transformation and a plugin.
Example
> mdastSqueezeParagraphs = require('mdast-squeeze-paragraphs/plugin')
> mdast.use(mdastStripBadges)
.process('![](http://img.shields.io/)\n\ntext')
'\n\ntext\n'
> mdast.use(mdastStripBadges)
.use(mdastSqueezeParagraphs)
.process('![](http://img.shields.io/)\n\ntext')
'text\n'
API
mdastSqueezeParagraphs(ast)
Remove empty paragraphs from the AST. Return the reference to the AST for convenience.
mdast.use(require('mdast-squeeze-paragraphs/plugin'))
Use this transformation as a plugin.
Install
npm install mdast-squeeze-paragraphs
License
MIT