JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1024282
  • Score
    100M100P100Q218680F
  • License MIT

Remove empty paragraphs from mdast tree

Package Exports

  • mdast-squeeze-paragraphs

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-squeeze-paragraphs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm

mdast-squeeze-paragraphs

Build Status Dependency Status

⚠️

This is an AST transformer for mdast syntax trees. A remark plugin has been split up into a different project.

Remove empty paragraphs from mdast tree.

Paragraph is considered empty if it is composed of whitespace characters only.

Example

var squeezeParagraphs = require('mdast-squeeze-paragraphs');

ast
//=> {
//     "type": "root",
//     "children": [
//       {
//         "type": "paragraph",
//         "children": []
//       },
//       {
//         "type": "paragraph",
//         "children": [
//           {
//             "type": "text",
//             "value": "foo"
//           }
//         ]
//       }
//     ]
//   }

squeezeParagraphs(ast)
//=> {
//     "type": "root",
//     "children": [
//       {
//         "type": "paragraph",
//         "children": [
//           {
//             "type": "text",
//             "value": "foo"
//           }
//         ]
//       }
//     ]
//   }

API

squeezeParagraphs(ast)

Modifies AST in-place. Returns ast.

Install

npm install mdast-squeeze-paragraphs

License

MIT