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 1.0.0 to 1.1.0

6

index.js

@@ -7,5 +7,9 @@ 'use strict';

ast.children = ast.children.filter(function (node) {
return !(node.type == 'paragraph' && !node.children.length);
return node.type != 'paragraph' || node.children.some(function (node) {
return node.type != 'text' || !/^\s*$/.test(node.value);
});
});
return ast;
};
};

3

package.json
{
"name": "mdast-squeeze-paragraphs",
"version": "1.0.0",
"version": "1.1.0",
"description": "Remove empty paragraphs left from other mdast transformations",

@@ -35,2 +35,3 @@ "author": "Eugene Sharygin <eush77@gmail.com>",

"devDependencies": {
"clone": "^1.0.2",
"mdast": "^0.26.2",

@@ -37,0 +38,0 @@ "tape": "^4.0.0"

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

[![Build Status](https://travis-ci.org/eush77/mdast-squeeze-paragraphs.svg)](https://travis-ci.org/eush77/mdast-squeeze-paragraphs)
[![Dependency Status][david-badge]][david]
[![Build Status][travis-badge]][travis] [![Dependency Status][david-badge]][david]
Remove empty paragraphs left from other [mdast](http://mdast.js.org) transformations.
Remove empty paragraphs left from other [mdast] transformations.
Paragraph is considered empty if it is composed from whitespace characters.
[mdast]: https://github.com/wooorm/mdast
[travis]: https://travis-ci.org/eush77/mdast-squeeze-paragraphs
[travis-badge]: https://travis-ci.org/eush77/mdast-squeeze-paragraphs.svg
[david]: https://david-dm.org/eush77/mdast-squeeze-paragraphs

@@ -17,5 +22,8 @@ [david-badge]: https://david-dm.org/eush77/mdast-squeeze-paragraphs.png

```js
> mdastSqueezeParagraphs = require('mdast-squeeze-paragraphs')
> mdast.use(mdastStripBadges)
.process('![](http://img.shields.io/)\n\ntext')
'\n\ntext\n'
> mdast.use(mdastStripBadges)

@@ -29,6 +37,16 @@ .use(mdastSqueezeParagraphs)

#### `mdast.use(mdastSqueezeParagraphs)`
```js
var mdastSqueezeParagraphs = require('mdast-squeeze-paragraphs');
Remove empty paragraphs from the AST.
mdast.use(mdastSqueezeParagraphs)
```
Modifies AST in-place.
## CLI
```
mdast -u mdast-squeeze-paragraphs
```
## Install

@@ -35,0 +53,0 @@

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