1.0.9 • Published 1 year ago

mdast-squeeze-links v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

mdast-squeeze-links

mdast utility to remove empty links from a tree.

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

Install

npm:

npm install mdast-squeeze-links

Use

var u = require('unist-builder')
var squeezeLinks = require('mdast-squeeze-links')

var tree = u('root', [
  u('link', {url: '#about'}, [u('text', 'About')]),
  u('link', {url: '#about'}, [u('text', ' ')])
])

squeezeLinks(tree)

console.dir(tree, {depth: null})

Yields:

{
  type: 'root',
  children: [ { type: 'link', url: '#about', children: [{ type: 'text', value: 'About' }] } ]
}

API

squeezeLinks(tree)

Modifies tree in-place. Returns tree.

Related

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 © Takuya Matsuyama

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

0.1.1

3 years ago

0.1.0

3 years ago