Socket
Socket
Sign inDemoInstall

mdast-squeeze-paragraphs

Package Overview
Dependencies
1
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mdast-squeeze-paragraphs

mdast utility to remove empty paragraphs from a tree


Version published
Weekly downloads
1.3M
decreased by-22.48%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

mdast-squeeze-paragraphs

Build Coverage Downloads Size Sponsors Backers Chat

mdast utility to remove empty paragraphs from a tree.

Paragraphs are considered empty if they do not contain non-whitespace characters.

Install

npm:

npm install mdast-squeeze-paragraphs

Use

var u = require('unist-builder')
var squeezeParagraphs = require('mdast-squeeze-paragraphs')

var 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' } ] } ] }

API

squeezeParagraphs(tree)

Modifies tree in-place. Returns tree.

Security

Use of mdast-squeeze-paragraphs 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.

License

MIT © Eugene Sharygin

Keywords

FAQs

Last updated on 22 Feb 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc