unified

Project: remarkjs/remark-squeeze-paragraphs

Package: remark-squeeze-paragraphs@5.0.0

  1. Dependents: 48
  2. remark plugin to remove empty paragraphs
  1. remark 187
  2. unified 175
  3. plugin 136
  4. markdown 132
  5. mdast 85
  6. remark-plugin 68
  7. remove 10
  8. whitespace 7
  9. clean 6
  10. paragraph 4
  11. empty 3
  12. squeeze 3

remark-squeeze-paragraphs

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to remove empty (or whitespace only) paragraphs.

Note!

This plugin is ready for the new parser in remark (remarkjs/remark#536). No change is needed: it works exactly the same now as it did previously!

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install remark-squeeze-paragraphs

Use

import {remark} from 'remark'
import remarkStripBadges from 'remark-strip-badges'
import remarkSqueezeParagraphs from 'remark-squeeze-paragraphs'

remark()
  .use(remarkStripBadges)
  .processSync('![](https://img.shields.io/)\n\ntext')
  .toString()
// => '\n\ntext\n'

remark()
  .use(remarkStripBadges)
  .use(remarkSqueezeParagraphs)
  .processSync('![](https://img.shields.io/)\n\ntext')
  .toString()
// => 'text\n'

API

This package exports no identifiers. The default export is remarkSqueezeParagraphs.

unified().use(remarkSqueezeParagraphs)

Remove empty (or white-space only) paragraphs.

Security

Use of remark-squeeze-paragraphs does not involve rehype (hast) or user content so there are no openings for cross-site scripting (XSS) attacks.

Contribute

See contributing.md in remarkjs/.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.

License

MIT © Eugene Sharygin