JSPM

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

mdast utility to find definition nodes in a tree

Package Exports

  • mdast-util-definitions

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-util-definitions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mdast-util-definitions

Build Coverage Downloads Size Sponsors Backers Chat

mdast utility to get definitions by identifier.

Supports funky keys, like __proto__ or toString.

Install

npm:

npm install mdast-util-definitions

Use

var remark = require('remark')
var definitions = require('mdast-util-definitions')

var ast = remark().parse('[example]: https://example.com "Example"')

var definition = definitions(ast)

definition('example')
// => {type: 'definition', 'title': 'Example', ...}

definition('foo')
// => null

API

definitions(node[, options])

Create a cache of all definitions in node.

options.commonmark

boolean, default: false — Turn on (true) to use CommonMark precedence: ignore definitions found later for duplicate definitions. The default behavior is to prefer the last found definition.

Returns

Function

definition(identifier)

Parameters
Returns

Node?Definition, if found.

Security

Use of mdast-util-definitions does not involve hast or user content so there are no openings for cross-site scripting (XSS) attacks.

Additionally, safe guards are in place to protect against prototype poisoning.

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 © Titus Wormer