mdast-squeeze-paragraphs
Advanced tools
Comparing version 2.1.1 to 3.0.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3969
1
85
4
9
1