JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5807748
  • Score
    100M100P100Q238896F
  • 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

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[, options])

Create a cache of all definitions in node.

options
  • commonmark (boolean, default: false) — Turn on to use CommonMark precedence: ignore later found definitions for duplicate definitions. The default behaviour is to prefer the last found definition.
Returns

Function

definition(identifier)

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

Node? — Definition, if found.

License

MIT © Titus Wormer