A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/syntax-tree/mdast-util-definitions below:

syntax-tree/mdast-util-definitions: utility to find definition nodes in an mdast tree

mdast utility to find definitions by identifier.

This package is a tiny utility that lets you find definitions.

This utility can be useful because definitions can occur after the things that reference them. It’s small and protects against prototype pollution.

This package is ESM only. In Node.js (version 16+), install with npm:

npm install mdast-util-definitions

In Deno with esm.sh:

import {definitions} from 'https://esm.sh/mdast-util-definitions@6'

In browsers with esm.sh:

<script type="module">
  import {definitions} from 'https://esm.sh/mdast-util-definitions@6?bundle'
</script>
import {definitions} from 'mdast-util-definitions'
import {fromMarkdown} from 'mdast-util-from-markdown'

const tree = fromMarkdown('[example]: https://example.com "Example"')

const definition = definitions(tree)

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

definition('foo')
// => undefined

This package exports the identifier definitions. There is no default export.

Find definitions in tree.

Uses CommonMark precedence, which means that earlier definitions are preferred over duplicate later definitions.

Getter (GetDefinition).

Get a definition by identifier (TypeScript type).

Definition corresponding to identifier (Definition) or undefined.

This package is fully typed with TypeScript. It exports the additional type GetDefinition.

Projects maintained by the unified collective are compatible with maintained versions of Node.js.

When we cut a new major release, we drop support for unmaintained versions of Node. This means we try to keep the current release line, mdast-util-definitions@^6, compatible with Node.js 16.

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, organization, or community you agree to abide by its terms.

MIT © Titus Wormer


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4