JSPM

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

Find definition nodes in mdast nodes

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 Status Coverage Status Chat

Get definitions in MDAST nodes by identifier. Supports funky keys, like __proto__ or toString.

Installation

npm:

npm install mdast-util-definitions

mdast-util-definitions is also available as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

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

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

var definition = definitions(ast);

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

definition('foo');
// null

API

definitions(node)

Create a cache of all definitions in node.

Parameters
  • node (Node) — Ancestor of definitions.
Returns

Function

definition(identifier)

Parameters
  • identifier (string) — Identifier of definition.
Returns

Node? — Definition, if found.

License

MIT © Titus Wormer