JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 632
  • Score
    100M100P100Q117286F
  • License MIT

mdast utility to remove empty links from a tree

Package Exports

  • mdast-squeeze-links
  • mdast-squeeze-links/lib/index.esm.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mdast-squeeze-links) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.

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