{"name":"mdast-util-definitions","version":"5.1.1","description":"mdast utility to find definition nodes in a tree","license":"MIT","keywords":["unist","mdast","mdast-util","util","utility","markdown","tree","node","definition","find","cache"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/mdast-util-definitions.git"},"bugs":{"url":"https://github.com/syntax-tree/mdast-util-definitions/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/mdast":"^3.0.0","@types/unist":"^2.0.0","unist-util-visit":"^4.0.0"},"devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark":"^14.0.0","remark-cli":"^10.0.0","remark-preset-wooorm":"^9.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.50.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"da82ba00d214317ec9dce34167e5a09adadf7969","homepage":"https://github.com/syntax-tree/mdast-util-definitions#readme","_id":"mdast-util-definitions@5.1.1","_nodeVersion":"18.2.0","_npmVersion":"8.9.0","dist":{"integrity":"sha512-rQ+Gv7mHttxHOBx2dkF4HWTg+EE+UR78ptQWDylzPKaQuVGdG4HIoY3SrS/pCp80nZ04greFvXbVFHT+uf0JVQ==","shasum":"2c1d684b28e53f84938bb06317944bee8efa79db","tarball":"http://registry-npm.ywwl.com/mdast-util-definitions/download/mdast-util-definitions-5.1.1.tgz","fileCount":5,"unpackedSize":9944,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmMOUahHyNF5uZbCyFN6Ql+U2pFNpGRRsvZ8emINXBqgIhAPolJvqAIGrClQbIWB2AbxZ80aHQf6otRBRdv6Zc8wJs"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJitWoBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoLKw/7BHsoJnNF7JdXaunrM78u7ShoxLc3bGd1+rjMGA5WOhLTy1by\r\nTClg7sRKTuK2/d7pI9XSU2yfV5YvzUUXPJZvXUD18JhcvEn/6/cD52P4XGWU\r\nLcUtXjcMgS03iWCw5bP7TRcgsxoP/sqW94Nj5AQtS+ajnW/B8VcDkXKy4pTo\r\n1UJLvUK86DHVua65GNYbnTS0E5VWRJTBoJ+sDg/IaZLW0lJK2uJQSg5L9e+p\r\nZdOdLhBhj+rntc2RsjHJmQpXO2xsnYFcv60GliK6aixMB270Yk5PUV2nwW3t\r\nlkUOFL80TiawVPzuYArlsh91TNnImuExBAj5Gg8TyBcFOC7aOFdgUOEIaVCB\r\n1KL5NR+eEHQAPju38I/RTMetFWyCgTbu1a1PuyG5lDkRo/KLOI5qf5UmU/wL\r\n4E9AIQFePGQLcRM8F/oKUyeJaqZok/P1TO3QpRt0JyPpnBYFpMBKx5BPM/74\r\nYjXQeUI+ctN+zoApRWdsnQBeGD9VrQk2u0NPpO2PhNBwSN65NymE8ef+e4zX\r\nTWcOyTbY7mC4itLORq+mZVqFXN0E40dnzrtR30i069+3A/54k5lYx4On9URr\r\nvKB4efQ+oTxSBdhZyEM2fr7uR0+LseaJ0vdcFzoVUmwfpam1Q3kdR8S1j93j\r\nF096utyhFfl+biy31qGrE2ZhIrtQOasppCI=\r\n=UDjy\r\n-----END PGP SIGNATURE-----\r\n","size":3986,"noattachment":false,"key":"/mdast-util-definitions/-/mdast-util-definitions-5.1.1.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mdast-util-definitions_5.1.1_1656056321034_0.6032678550123471"},"_hasShrinkwrap":false,"readme":"# mdast-util-definitions\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[mdast][] utility to find definitions by `identifier`.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`definitions(tree)`](#definitionstree)\n    *   [`GetDefinition`](#getdefinition)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a tiny utility that lets you find definitions.\n\n## When should I use this?\n\nThis utility can be useful because definitions can occur after the things that\nreference them.\nIt’s small and protects against prototype pollution.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install mdast-util-definitions\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {definitions} from 'https://esm.sh/mdast-util-definitions@6'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {definitions} from 'https://esm.sh/mdast-util-definitions@6?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {definitions} from 'mdast-util-definitions'\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\nconst tree = fromMarkdown('[example]: https://example.com \"Example\"')\n\nconst definition = definitions(tree)\n\ndefinition('example')\n// => {type: 'definition', 'title': 'Example', …}\n\ndefinition('foo')\n// => undefined\n```\n\n## API\n\nThis package exports the identifier [`definitions`][api-definitions].\nThere is no default export.\n\n### `definitions(tree)`\n\nFind definitions in `tree`.\n\nUses CommonMark precedence, which means that earlier definitions are\npreferred over duplicate later definitions.\n\n###### Parameters\n\n*   `tree` ([`Node`][node])\n    — tree to check\n\n###### Returns\n\nGetter ([`GetDefinition`][api-getdefinition]).\n\n### `GetDefinition`\n\nGet a definition by identifier (TypeScript type).\n\n###### Parameters\n\n*   `identifier` (`string`, optional)\n    — identifier of definition\n\n###### Returns\n\nDefinition corresponding to `identifier` ([`Definition`][definition]) or\n`undefined`.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type  [`GetDefinition`][api-getdefinition].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`mdast-util-definitions@^6`, compatible with Node.js 16.\n\n## Security\n\nUse of `mdast-util-definitions` does not involve **[hast][]** or user content so\nthere are no openings for [cross-site scripting (XSS)][xss] attacks.\nAdditionally, safe guards are in place to protect against prototype poisoning.\n\n## Related\n\n*   [`unist-util-index`](https://github.com/syntax-tree/unist-util-index)\n    — index property values or computed keys to nodes\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/syntax-tree/mdast-util-definitions/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/mdast-util-definitions/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-definitions.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/mdast-util-definitions\n\n[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-definitions.svg\n\n[downloads]: https://www.npmjs.com/package/mdast-util-definitions\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-definitions\n\n[size]: https://bundlejs.com/?q=mdast-util-definitions\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[mdast]: https://github.com/syntax-tree/mdast\n\n[node]: https://github.com/syntax-tree/unist#node\n\n[definition]: https://github.com/syntax-tree/mdast#definition\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[hast]: https://github.com/syntax-tree/hast\n\n[api-definitions]: #definitionstree\n\n[api-getdefinition]: #getdefinition\n","publish_time":1656056321156,"_cnpm_publish_time":1656056321156,"dist-tags":{"latest":"6.0.0"}}