|
|
5 dni temu | |
|---|---|---|
| .. | ||
| index.js | 5 dni temu | |
| license | 5 dni temu | |
| package.json | 5 dni temu | |
| readme.md | 5 dni temu | |
mdast utility to get definitions by identifier.
Supports funky keys, like __proto__ or toString.
npm:
npm install mdast-util-definitions
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
definitions(node[, options])Create a cache of all definitions in node.
options.commonmarkboolean, default: false — Turn on to use CommonMark precedence: ignore
definitions found later for duplicate definitions.
The default behaviour is to prefer the last found definition.
definition(identifier)identifier (string) — Identifier of definition.Node? — Definition, if found.
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.
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, organisation, or community you agree to abide by its terms.