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

Get a definition in node
by identifier
. Supports weird keys (like
__proto__
or toString
).
Installation
npm:
npm install mdast-util-definitions
mdast-util-definitions is also available for duo and 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 getDefinition = definitions(ast);
getDefinition('example');
// {type: 'definition', 'title': 'Example', ...}
getDefinition('foo');
// null
API
getDefinitionFactory(node): getDefinition
Create a cache of all definition
s in node
.
Parameters:
node
(Node
) — (Grand)parent of definitions.
Returns: Function
— See getDefinition
getDefinition(identifier)
Get a definition by identifier
.
Parameters:
identifier
(string
) — Identifier of definition.
Returns: Node?
— Definition, if found.