{"name":"mdast-util-gfm-footnote","version":"1.0.2","description":"mdast extension to parse and serialize GFM footnotes","license":"MIT","keywords":["unist","mdast","mdast-util","util","utility","markdown","markup","gfm","footnote","note"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/mdast-util-gfm-footnote.git"},"bugs":{"url":"https://github.com/syntax-tree/mdast-util-gfm-footnote/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","mdast-util-to-markdown":"^1.3.0","micromark-util-normalize-identifier":"^1.0.0"},"devDependencies":{"@types/node":"^18.0.0","c8":"^7.0.0","mdast-util-from-markdown":"^1.0.0","micromark-extension-gfm-footnote":"^1.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.53.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","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,"ignoreCatch":true},"gitHead":"50f37ca7114dcdc5d0305b73ccb059c65e94abea","homepage":"https://github.com/syntax-tree/mdast-util-gfm-footnote#readme","_id":"mdast-util-gfm-footnote@1.0.2","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-56D19KOGbE00uKVj3sgIykpwKL179QsVFwx/DCW0u/0+URsryacI4MAdNJl0dh+u2PSsD9FtxPFbHCzJ78qJFQ==","shasum":"ce5e49b639c44de68d5bf5399877a14d5020424e","tarball":"http://registry-npm.ywwl.com/mdast-util-gfm-footnote/download/mdast-util-gfm-footnote-1.0.2.tgz","fileCount":7,"unpackedSize":21598,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCurcKTnfKNoTAnQBSK+xYrB60aBjxEfykxWxeu5cP9hAIgWEN6LWK++2EVVUSoFBUWXMCcL7jDkm85F8fu+xqkF+4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj1UbOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpppRAAmCw0oEFbpsKktZvVsyRvBtB14sMIp3eA3mBeVrkC+7KRP7Ja\r\nN123npfXMmNf7GIXrrO8c7hPbN60j8Ypi1/9YOoGU8mYTxehi34td7J4bo+8\r\nEzKBzl9dDZ2DSUfir9yhIsm5ZMNbrMo9UZu67wmq6WqitxdS12jvtcR3WQVz\r\nx7AbxfdqcxG1NZhjcs1e6dKv13zWGBKiBgQSqRgr/y/u4Q8z4y/Ym13cC6tq\r\nXZYxRHIoyZt770xLRutVcuvZJCUYmFRh7NxgCaugn9nR0GG4uHT5xViqfmMm\r\nsThl0+gVMrPEfNnSh5RnWgYks0tC8OuDwL+QFDY7XGWxCvBk4p4+hRjY6E6B\r\nWaPY2RDemWfh8/hclmtUe/RTJswy9TNk6oazPJGVlXX3Mt4fr9qDfrDTeMJk\r\niq5hqXXF0Os6sZ6frtOcAMjOBlHNxZ1CeVHtprUGmlB3vhMNbkf0UENHyb+Z\r\npkIRzf9zJ3w+/+dvdid26Qo8CKHN7uFErx+8HxAo9wr/5yiybVXx8wRZz8dl\r\nHsnAC2ix22ECmCGeWGmtWhrRF1vHMBSSjVWNcoVP8WUGjj4Y8hQAR1MlmL4A\r\nNwxdi3ThnRCrQCFgngltu93IJzvWULBEvl41g7PMqSFUj3oNb06b7vKCMKR9\r\njoSMn8XPxgP4z5OGgM/BMZ5NuLGKiWYHpVo=\r\n=guXd\r\n-----END PGP SIGNATURE-----\r\n","size":6341,"noattachment":false,"key":"/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-1.0.2.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-gfm-footnote_1.0.2_1674921678114_0.33176520024135003"},"_hasShrinkwrap":false,"readme":"# mdast-util-gfm-footnote\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][] extensions to parse and serialize [GFM][] footnotes.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When to use this](#when-to-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`gfmFootnoteFromMarkdown()`](#gfmfootnotefrommarkdown)\n    *   [`gfmFootnoteToMarkdown()`](#gfmfootnotetomarkdown)\n*   [HTML](#html)\n*   [Syntax](#syntax)\n*   [Syntax tree](#syntax-tree)\n    *   [Nodes](#nodes)\n    *   [Content model](#content-model)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package contains two extensions that add support for GFM footnote syntax\nin markdown to [mdast][].\nThese extensions plug into\n[`mdast-util-from-markdown`][mdast-util-from-markdown] (to support parsing\nfootnotes in markdown into a syntax tree) and\n[`mdast-util-to-markdown`][mdast-util-to-markdown] (to support serializing\nfootnotes in syntax trees to markdown).\n\nGFM footnotes were [announced September 30, 2021][post] but are not specified.\nTheir implementation on github.com is currently buggy.\nThe bugs have been reported on [`cmark-gfm`][cmark-gfm].\n\n## When to use this\n\nYou can use these extensions when you are working with\n`mdast-util-from-markdown` and `mdast-util-to-markdown` already.\n\nWhen working with `mdast-util-from-markdown`, you must combine this package\nwith [`micromark-extension-gfm-footnote`][micromark-extension-gfm-footnote].\n\nWhen you don’t need a syntax tree, you can use [`micromark`][micromark]\ndirectly with `micromark-extension-gfm-footnote`.\n\nWhen you are working with syntax trees and want all of GFM, use\n[`mdast-util-gfm`][mdast-util-gfm] instead.\n\nAll these packages are used [`remark-gfm`][remark-gfm], which\nfocusses on making it easier to transform content by abstracting these\ninternals away.\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][mdast-util-to-hast].\nIf your content is not in English, you should configure that utility.\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-gfm-footnote\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from 'https://esm.sh/mdast-util-gfm-footnote@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from 'https://esm.sh/mdast-util-gfm-footnote@2?bundle'\n</script>\n```\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\nHi![^1]\n\n[^1]: big note\n```\n\n…and our module `example.js` looks as follows:\n\n```js\nimport fs from 'node:fs/promises'\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {toMarkdown} from 'mdast-util-to-markdown'\nimport {gfmFootnote} from 'micromark-extension-gfm-footnote'\nimport {gfmFootnoteFromMarkdown, gfmFootnoteToMarkdown} from 'mdast-util-gfm-footnote'\n\nconst doc = await fs.readFile('example.md')\n\nconst tree = fromMarkdown(doc, {\n  extensions: [gfmFootnote()],\n  mdastExtensions: [gfmFootnoteFromMarkdown()]\n})\n\nconsole.log(tree)\n\nconst out = toMarkdown(tree, {extensions: [gfmFootnoteToMarkdown()]})\n\nconsole.log(out)\n```\n\n…now running `node example.js` yields (positional info removed for brevity):\n\n```js\n{\n  type: 'root',\n  children: [\n    {\n      type: 'paragraph',\n      children: [\n        {type: 'text', value: 'Hi!'},\n        {type: 'footnoteReference', identifier: '1', label: '1'}\n      ]\n    },\n    {\n      type: 'footnoteDefinition',\n      identifier: '1',\n      label: '1',\n      children: [\n        {type: 'paragraph', children: [{type: 'text', value: 'big note'}]}\n      ]\n    }\n  ]\n}\n```\n\n```markdown\nHi\\![^1]\n\n[^1]: big note\n```\n\n## API\n\nThis package exports the identifiers\n[`gfmFootnoteFromMarkdown`][api-gfmfootnotefrommarkdown] and\n[`gfmFootnoteToMarkdown`][api-gfmfootnotetomarkdown].\nThere is no default export.\n\n### `gfmFootnoteFromMarkdown()`\n\nCreate an extension for\n[`mdast-util-from-markdown`][mdast-util-from-markdown]\nto enable GFM footnotes in markdown.\n\n###### Returns\n\nExtension for `mdast-util-from-markdown`\n([`FromMarkdownExtension`][frommarkdownextension]).\n\n### `gfmFootnoteToMarkdown()`\n\nCreate an extension for\n[`mdast-util-to-markdown`][mdast-util-to-markdown]\nto enable GFM footnotes in markdown.\n\n###### Returns\n\nExtension for `mdast-util-to-markdown`\n([`ToMarkdownExtension`][tomarkdownextension]).\n\n## HTML\n\nThis utility does not handle how markdown is turned to HTML.\nThat’s done by [`mdast-util-to-hast`][mdast-util-to-hast].\nIf your content is not in English, you should configure that utility.\n\n## Syntax\n\nSee [Syntax in `micromark-extension-gfm-footnote`][syntax].\n\n## Syntax tree\n\nThe following interfaces are added to **[mdast][]** by this utility.\n\n### Nodes\n\n#### `FootnoteDefinition`\n\n```idl\ninterface FootnoteDefinition <: Parent {\n  type: 'footnoteDefinition'\n  children: [FlowContent]\n}\n\nFootnoteDefinition includes Association\n```\n\n**FootnoteDefinition** (**[Parent][dfn-parent]**) represents content relating\nto the document that is outside its flow.\n\n**FootnoteDefinition** can be used where **[flow][dfn-flow-content]** content\nis expected.\nIts content model is also **[flow][dfn-flow-content]** content.\n\n**FootnoteDefinition** includes the mixin\n**[Association][dfn-mxn-association]**.\n\n**FootnoteDefinition** should be associated with\n**[FootnoteReferences][dfn-footnote-reference]**.\n\nFor example, the following markdown:\n\n```markdown\n[^alpha]: bravo and charlie.\n```\n\nYields:\n\n```js\n{\n  type: 'footnoteDefinition',\n  identifier: 'alpha',\n  label: 'alpha',\n  children: [{\n    type: 'paragraph',\n    children: [{type: 'text', value: 'bravo and charlie.'}]\n  }]\n}\n```\n\n#### `FootnoteReference`\n\n```idl\ninterface FootnoteReference <: Node {\n  type: 'footnoteReference'\n}\n\nFootnoteReference includes Association\n```\n\n**FootnoteReference** (**[Node][dfn-node]**) represents a marker through\nassociation.\n\n**FootnoteReference** can be used where\n**[phrasing][dfn-phrasing-content]** content is expected.\nIt has no content model.\n\n**FootnoteReference** includes the mixin **[Association][dfn-mxn-association]**.\n\n**FootnoteReference** should be associated with a\n**[FootnoteDefinition][dfn-footnote-definition]**.\n\nFor example, the following markdown:\n\n```markdown\n[^alpha]\n```\n\nYields:\n\n```js\n{\n  type: 'footnoteReference',\n  identifier: 'alpha',\n  label: 'alpha'\n}\n```\n\n### Content model\n\n#### `FlowContent` (GFM footnotes)\n\n```idl\ntype FlowContentGfm = FootnoteDefinition | FlowContent\n```\n\n#### `PhrasingContent` (GFM footnotes)\n\n```idl\ntype PhrasingContentGfm = FootnoteReference | PhrasingContent\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt does not export additional types.\n\nThe `FootnoteDefinition` and `FootnoteReference` types of the mdast nodes are\nexposed from `@types/mdast`.\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-gfm-footnote@^2`, compatible with Node.js 16.\n\n## Related\n\n*   [`remark-gfm`][remark-gfm]\n    — remark plugin to support GFM\n*   [`mdast-util-gfm`][mdast-util-gfm]\n    — same but all of GFM (autolink literals, footnotes, strikethrough, tables,\n    tasklists)\n*   [`micromark-extension-gfm-footnote`][micromark-extension-gfm-footnote]\n    — micromark extension to parse GFM footnotes\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-gfm-footnote/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/mdast-util-gfm-footnote/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-gfm-footnote.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/mdast-util-gfm-footnote\n\n[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-gfm-footnote.svg\n\n[downloads]: https://www.npmjs.com/package/mdast-util-gfm-footnote\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-gfm-footnote\n\n[size]: https://bundlejs.com/?q=mdast-util-gfm-footnote\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[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[license]: license\n\n[author]: https://wooorm.com\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[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm\n\n[remark-gfm]: https://github.com/remarkjs/remark-gfm\n\n[micromark]: https://github.com/micromark/micromark\n\n[micromark-extension-gfm-footnote]: https://github.com/micromark/micromark-extension-gfm-footnote\n\n[syntax]: https://github.com/micromark/micromark-extension-gfm-footnote#syntax\n\n[gfm]: https://github.github.com/gfm/\n\n[cmark-gfm]: https://github.com/github/cmark-gfm\n\n[post]: https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/\n\n[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast\n\n[dfn-parent]: https://github.com/syntax-tree/mdast#parent\n\n[dfn-mxn-association]: https://github.com/syntax-tree/mdast#association\n\n[dfn-node]: https://github.com/syntax-tree/unist#node\n\n[frommarkdownextension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension\n\n[tomarkdownextension]: https://github.com/syntax-tree/mdast-util-to-markdown#options\n\n[dfn-flow-content]: #flowcontent-gfm-footnotes\n\n[dfn-phrasing-content]: #phrasingcontent-gfm-footnotes\n\n[dfn-footnote-reference]: #footnotereference\n\n[dfn-footnote-definition]: #footnotedefinition\n\n[api-gfmfootnotefrommarkdown]: #gfmfootnotefrommarkdown\n\n[api-gfmfootnotetomarkdown]: #gfmfootnotetomarkdown\n","publish_time":1674921678278,"_cnpm_publish_time":1674921678278,"dist-tags":{"latest":"2.1.0"}}