Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mdast-squeeze-paragraphs

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-squeeze-paragraphs - npm Package Compare versions

Comparing version 2.1.1 to 3.0.0

11

package.json
{
"name": "mdast-squeeze-paragraphs",
"version": "2.1.1",
"description": "Remove empty paragraphs left from other mdast transformations",
"version": "3.0.0",
"description": "Remove empty paragraphs from mdast tree",
"author": "Eugene Sharygin <eush77@gmail.com>",

@@ -11,4 +11,3 @@ "license": "MIT",

"files": [
"index.js",
"plugin.js"
"index.js"
],

@@ -22,4 +21,2 @@ "homepage": "https://github.com/eush77/mdast-squeeze-paragraphs",

"mdast",
"plugin",
"markdown",
"squeeze",

@@ -38,6 +35,4 @@ "remove",

"devDependencies": {
"clone": "^1.0.2",
"mdast": "^0.26.2",
"tape": "^4.0.0"
}
}

@@ -7,9 +7,13 @@ [![npm](https://nodei.co/npm/mdast-squeeze-paragraphs.png)](https://npmjs.com/package/mdast-squeeze-paragraphs)

Remove empty paragraphs left from other [mdast] transformations.
> :warning:
>
> This is an AST transformer for [mdast] syntax trees. A [remark] plugin has been split up into [a different project][remark-squeeze-paragraphs].
Paragraph is considered empty if it is composed from whitespace characters.
Remove empty paragraphs from [mdast] tree.
This module provides both AST transformation and a plugin.
Paragraph is considered empty if it is composed of whitespace characters only.
[mdast]: https://github.com/wooorm/mdast
[remark]: https://github.com/wooorm/remark
[remark-squeeze-paragraphs]: https://github.com/eush77/remark-squeeze-paragraphs

@@ -24,12 +28,39 @@ [travis]: https://travis-ci.org/eush77/mdast-squeeze-paragraphs

```js
> mdastSqueezeParagraphs = require('mdast-squeeze-paragraphs/plugin')
var squeezeParagraphs = require('mdast-squeeze-paragraphs');
> mdast.use(mdastStripBadges)
.process('![](http://img.shields.io/)\n\ntext')
'\n\ntext\n'
ast
//=> {
// "type": "root",
// "children": [
// {
// "type": "paragraph",
// "children": []
// },
// {
// "type": "paragraph",
// "children": [
// {
// "type": "text",
// "value": "foo"
// }
// ]
// }
// ]
// }
> mdast.use(mdastStripBadges)
.use(mdastSqueezeParagraphs)
.process('![](http://img.shields.io/)\n\ntext')
'text\n'
squeezeParagraphs(ast)
//=> {
// "type": "root",
// "children": [
// {
// "type": "paragraph",
// "children": [
// {
// "type": "text",
// "value": "foo"
// }
// ]
// }
// ]
// }
```

@@ -39,9 +70,9 @@

#### `mdastSqueezeParagraphs(ast)`
#### `squeezeParagraphs(ast)`
Remove empty paragraphs from the AST. Return the reference to the AST for convenience.
Modifies AST in-place. Returns `ast`.
#### `mdast.use(require('mdast-squeeze-paragraphs/plugin'))`
## Related
Use this transformation as a plugin.
- [remark-squeeze-paragraphs] — [remark] plugin wrapper.

@@ -48,0 +79,0 @@ ## Install

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc