{"_id":"@bernardjoseph/mdast-util-citekey","_rev":"1-b02df1075b0aba355fe60fde5d76927d","name":"@bernardjoseph/mdast-util-citekey","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@bernardjoseph/mdast-util-citekey","version":"0.1.0","description":"mdast extension to parse and serialize Pandoc-style citation keys","license":"MIT","keywords":["mdast","mdast-util","cite","citation","pandoc","markdown","remark","unified"],"repository":{"type":"git","url":"git+https://github.com/bernardjoseph/mdast-util-citekey.git"},"author":{"name":"Bernd Rellermeyer","email":"bernd.rellermeyer@t-online.de"},"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/mdast":"^3.0.10","mdast-util-to-markdown":"^1.5.0"},"devDependencies":{"@types/tape":"^4.13.2","@bernardjoseph/micromark-extension-citekey":"^0.1.0","c8":"^7.13.0","mdast-util-from-markdown":"^1.3.0","prettier":"^2.8.4","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.1.0","rimraf":"^4.4.0","tape":"^5.6.3","type-coverage":"^2.24.1","typescript":"^4.9.5","xo":"^0.53.1"},"scripts":{"build":"rimraf --glob \"{index,test}.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 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":["remark-preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"bugs":{"url":"https://github.com/bernardjoseph/mdast-util-citekey/issues"},"homepage":"https://github.com/bernardjoseph/mdast-util-citekey#readme","_id":"@bernardjoseph/mdast-util-citekey@0.1.0","_nodeVersion":"19.8.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-TMmDeA24rX69tBBPyHOOXjKc6ebfWCBxxVI0JyS144+a+SiKUIdXFni6+fRcIY/VBagix+UhNxvbomkPOb0ynA==","shasum":"5548909c33c3a6caebb4f0369fe7d92279c34b7f","tarball":"https://registry.npmjs.org/@bernardjoseph/mdast-util-citekey/-/mdast-util-citekey-0.1.0.tgz","fileCount":5,"unpackedSize":11927,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGNEYEiS4P6h0MgX8Fmila0LNmnojdK51G85bIUeoXNyAiAhGIBLT7VMDz/5/YNKt/D3VpB7OT7tjYmF+q8M6f7Wiw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJVbMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpkPRAAlk4szIuTWMWkffNaouoag+Lm3U+1zt6mjSIDTQYB/WjVKPQL\r\nwOj2XiBWZlLxXOyQFrsFKCRXmuTAFmX6eWDfuVHaFn9u6pQgPIXIFeUb/Zmx\r\ndRT40jaLRMQ3qyKbjEIUOMvMOFoDFjPo9a1xYd55qti55IMweFticjO8VOkZ\r\nsxxZCCrKfs82byDT5iIQtaBAjQFbyWug135L6K4cE2BlQtXMtCtXdfN5T2e0\r\n3PKkKjjhpag7Ayn54B/5UV0dzoVfQu7kLXxfFs2hmIqo2KsfldkbdLgu8N7b\r\nYHx8+8FWXC1dEntkeHuLdap3hJ+fQ4dLKmMk8Ws8l2v2R7TjuusDRt+8U2NL\r\nIlmM+Hxlg+mUiP3DxkkOxIG9Ry91ic9sPXtERTNHA+t/i347rMTakYnwmECw\r\nkhR2euo/gF9NQhQyyvyz60TV2/dlQ8tv/sJZn4/eUO0ET03zwLOxoHmBUmSW\r\nA2wZ0xG1fq/4cmztUFQ08bV9I1Iw810l0GJryOw2t0pxxXJ9h7V1UUJ3EAgf\r\ni3K49KAX9WiM7sz8ZotiN/UptHJTkwiiMyq4eTuuMNsllKHPo7ukP8wrPiJf\r\nXlggjGnfXumElD9fOt5k0aPNgVu8wvDcgW10n8uDDZrQltcX+O9gBpAu8dgd\r\nB/UKer2Cj5gVbY8i4UCUnz4AfBUhJL3iwec=\r\n=q/OO\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bernardjoseph","email":"bernd.rellermeyer@t-online.de"},"directories":{},"maintainers":[{"name":"bernardjoseph","email":"bernd.rellermeyer@t-online.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mdast-util-citekey_0.1.0_1680168652473_0.10356489065637997"},"_hasShrinkwrap":false},"0.1.1":{"name":"@bernardjoseph/mdast-util-citekey","version":"0.1.1","description":"mdast extension to parse and serialize Pandoc-style citation keys","license":"MIT","keywords":["mdast","mdast-util","cite","citation","pandoc","markdown","remark","unified"],"repository":{"type":"git","url":"git+https://github.com/bernardjoseph/mdast-util-citekey.git"},"author":{"name":"Bernd Rellermeyer","email":"bernd.rellermeyer@t-online.de"},"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/mdast":"^3.0.10","mdast-util-to-markdown":"^1.5.0"},"devDependencies":{"@types/tape":"^4.13.2","@bernardjoseph/micromark-extension-citekey":"^0.1.0","c8":"^7.13.0","mdast-util-from-markdown":"^1.3.0","prettier":"^2.8.4","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.1.0","rimraf":"^4.4.0","tape":"^5.6.3","type-coverage":"^2.24.1","typescript":"^4.9.5","xo":"^0.53.1"},"scripts":{"build":"rimraf --glob \"{index,test}.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 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":["remark-preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true,"ignoreCatch":true},"gitHead":"8df76382011801a5dcdcbbf3ba44b536d9778bcd","bugs":{"url":"https://github.com/bernardjoseph/mdast-util-citekey/issues"},"homepage":"https://github.com/bernardjoseph/mdast-util-citekey#readme","_id":"@bernardjoseph/mdast-util-citekey@0.1.1","_nodeVersion":"19.8.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-Wqu7F/DjVBt75xvr2+0SFc55cwXdPXRPXYNus/JzD7LP9+xpajDhvFhPidsbV/bmQ2lmL4m6eiuaeQ+oB1PBVQ==","shasum":"5ad1539480e3379d7347ef3c79ce4298c52585a9","tarball":"https://registry.npmjs.org/@bernardjoseph/mdast-util-citekey/-/mdast-util-citekey-0.1.1.tgz","fileCount":5,"unpackedSize":11935,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPg5tx68aohlhx53gXf5ZWSPXETHxU4X6w1OrV3U7PIwIgZI6mAvYG6zu/zK+gV4RDsY9yzWK/xyD+YZXcox6+KRQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJXoaACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmreog//c+PnIpAFsHl3OAsQAKC62TlVdEEQCdNs/I6yaNk24YH4KOMF\r\nMWwgdyVqUKpo1F4e1jnBnA2QmRnPyrVvpjD6QsL1tU85SQiJN6/OFYEcjtsP\r\nNWfWQe4NZPw6UqnMlW+iRuWniyNjdQuKFwNF+69URhrctzQxjAdeChC3EjAd\r\nfMxDsseVQ3OsP4WWCaSIdAMD/nTGbylLmkEyU5CnrDzwcakxQKWAWUX+h4ne\r\n5dBlhh11BkxJKRNqdkzYy7QRMGnJYAHZJdYqW48i9KXgSMTr1k3GTpoZgu2c\r\njkzchHsR974JX7PGTlMTUy+oj9duVXQbuyoJBvJueUA2IRH6BGkgeF4rFQr4\r\nfM2vACTzAxeeW9LKtjjtIukyz1zlYJgEDp14qAbw0xHyRdRbUHvyeJRQR3de\r\nkPDBEJYKI5OBGCIDj7Jp3+huG53yk9iByUQotrTjzO3yfG2g0Vu2Zz072U0Q\r\nw2f+BJhes5ea+UKY6RER2Sxb+4AZMsY6+3tA1QhOAKClmIcUj3Ga76SWtSnV\r\nYG59UUw9k2C/JhvXVcdCqGQccjg07uhwES3iTNs5MjQQd7uXP0B7MpxUirRq\r\nVY8gvG7KKEV1wRl7GQUc5FMnyjVViuv18jK+qB1stQc35C/F4VZ2lXXxD7bZ\r\nN6iXYAfsjSBsGbEqYdsajv3zvNB26YNEs8E=\r\n=AzVT\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bernardjoseph","email":"bernd.rellermeyer@t-online.de"},"directories":{},"maintainers":[{"name":"bernardjoseph","email":"bernd.rellermeyer@t-online.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mdast-util-citekey_0.1.1_1680177689888_0.05546267611591138"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-30T09:30:52.395Z","0.1.0":"2023-03-30T09:30:52.630Z","modified":"2023-03-30T12:01:30.181Z","0.1.1":"2023-03-30T12:01:30.030Z"},"maintainers":[{"name":"bernardjoseph","email":"bernd.rellermeyer@t-online.de"}],"description":"mdast extension to parse and serialize Pandoc-style citation keys","homepage":"https://github.com/bernardjoseph/mdast-util-citekey#readme","keywords":["mdast","mdast-util","cite","citation","pandoc","markdown","remark","unified"],"repository":{"type":"git","url":"git+https://github.com/bernardjoseph/mdast-util-citekey.git"},"author":{"name":"Bernd Rellermeyer","email":"bernd.rellermeyer@t-online.de"},"bugs":{"url":"https://github.com/bernardjoseph/mdast-util-citekey/issues"},"license":"MIT","readme":"# mdast-util-citekey\n\nExtension for [`mdast-util-from-markdown`][from-markdown] and\n[`mdast-util-to-markdown`][to-markdown] to support [Pandoc][]-style citation\nkeys in **[mdast][]**.\n\n## When to use this\n\nUse this if you’re dealing with the AST manually.\nIt might be better to use [`remark-citekey`][remark-citekey] with\n**[remark][]**, which includes this but provides a nicer interface and makes it\neasier to combine with hundreds of plugins.\n\n## Install\n\nThis package is [ESM\nonly](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):\nNode 12+ is needed to use it and it must be `import`ed instead of `require`d.\n\n[npm][]:\n\n```sh\nnpm install mdast-util-citekey\n```\n\n## Use\n\nSay our module, `example.js`, looks as follows:\n\n```js\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {toMarkdown} from 'mdast-util-to-markdown'\nimport {citekey} from 'micromark-extension-citekey'\nimport {citekeyFromMarkdown, citekeyToMarkdown} from '@bernardjoseph/mdast-util-citekey'\n\nconst doc = 'See @wadler1989, sec. 1.3, and @{hughes1990.}, pp. 4.'\n\nconst tree = fromMarkdown(doc, {\n  extensions: [citekey()],\n  mdastExtensions: [citekeyFromMarkdown]\n}).children[0]\n\nconsole.dir(tree, {depth: null})\n\nconst out = toMarkdown(tree, {extensions: [citekeyToMarkdown]})\n\nconsole.log(out)\n```\n\nNow, running `node example` yields (positional info removed for brevity):\n\n```js\n{\n  type: 'paragraph',\n  children: [\n    {\n      type: 'text',\n      value: 'See '\n    },\n    {\n      type: 'citekey',\n      children: [\n        {\n          type: 'citekeyMarker',\n          value: '@'\n        },\n        {\n          type: 'citekeyId',\n          value: 'wadler1989'\n        }\n      ]\n    },\n    {\n      type: 'text',\n      value: ', sec. 1.3, and '\n    },\n    {\n      type: 'citekey',\n      children: [\n        {\n          type: 'citekeyMarker',\n          value: '@'\n        },\n        {\n          type: 'citekeyStart',\n          value: '{'\n        },\n        {\n          type: 'citekeyId',\n          value: 'hughes1990.'\n        },\n        {\n          type: 'citekeyEnd',\n          value: '}'\n        }\n      ]\n    },\n    {\n      type: 'text',\n      value: ', pp. 4.'\n    }\n  ]\n}\n```\n\n```markdown\nSee @wadler1989, sec. 1.3, and @{hughes1990.}, pp. 4.\n```\n\n## API\n\n### `citekeyFromMarkdown`\n\n### `citekeyToMarkdown`\n\nSupport [Pandoc][]-style citation keys.\nThe exports are extensions for [`mdast-util-from-markdown`][from-markdown] and\n[`mdast-util-to-markdown`][to-markdown], respectively.\nSee the [citation syntax][pandoc-citation-syntax] section of the [Pandoc\nmanual][pandoc-manual] for the syntax of [Pandoc][]-style citation keys.\n\nThis utility handles parsing and serializing.\n[Traverse the tree][traversal] to change them to whatever you please.\n\n## Syntax tree\n\nThe following Nodes are added to **[mdast][]** by this utility.\n\n### Nodes\n\n```idl\ninterface Citekey extends Parent {\n  type: 'citekey'\n  children: Array<CitekeyMarker | CitekeyStart | CitekeyId | CitekeyEnd>\n}\n\ninterface CitekeyMarker extends Literal {\n  type: 'citekeyMarker'\n}\n\ninterface CitekeyStart extends Literal {\n  type: 'citekeyStart'\n}\n\ninterface CitekeyId extends Literal {\n  type: 'citekeyId'\n}\n\ninterface CitekeyEnd extends Literal {\n  type: 'citekeyEnd'\n}\n```\n\n**Citekey**, **CitekeyMarker**, **CitekeyStart**, **CitekeyId** and\n**CitekeyEnd** (**[Literal][dfn-literal]**) can be used where\n**[phrasing][dfn-phrasing-content]** content is expected.\n\nFor example, the following Markdown:\n\n```markdown\n'@wadler1989\n```\n\nYields:\n\n```js\n{\n  type: 'citekey',\n  children: [\n    {\n      type: 'citekeyMarker',\n      value: '@'\n    },\n    {\n      type: 'citekeyId',\n      value: 'wadler1989'\n    }\n  ]\n}\n```\n\nAnd the following Markdown:\n\n```markdown\n'@{hughes1990.}\n```\n\nYields:\n\n```js\n{\n  type: 'citekey',\n  children: [\n    {\n      type: 'citekeyMarker',\n      value: '@'\n    },\n    {\n      type: 'citekeyStart',\n      value: '{'\n    },\n    {\n      type: 'citekeyId',\n      value: 'hughes1990.'\n    },\n    {\n      type: 'citekeyEnd',\n      value: '}'\n    }\n  ]\n}\n```\n\n## Related\n\n*   [`remarkjs/remark`][remark]\n    — markdown processor powered by plugins\n*   [`micromark/micromark`][micromark]\n    — the smallest commonmark-compliant markdown parser that exists\n*   [`@bernardjoseph/remark-citekey`][remark-citekey]\n    — remark plugin to support citation keys\n*   [`@bernardjoseph/micromark-extension-citekey`][micromark-extension-citekey]\n    — mdast utility to support citation keys\n*   [`syntax-tree/mdast-util-from-markdown`][from-markdown]\n    — mdast parser using `micromark` to create mdast from markdown\n*   [`syntax-tree/mdast-util-to-markdown`][to-markdown]\n    — mdast serializer to create markdown from mdast\n\n## Contribute\n\nSee [`contributing.md` in `micromark/.github`][contributing] for ways to get\nstarted.\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] © Bernd Rellermeyer\n\n<!-- Definitions -->\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[remark]: https://github.com/remarkjs/remark\n\n[remark-citekey]: https://github.com/bernardjoseph/remark-citekey\n\n[mdast]: https://github.com/syntax-tree/mdast\n\n[from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown\n\n[dfn-phrasing-content]: https://github.com/syntax-tree/mdast#phrasingcontent\n\n[micromark]: https://github.com/micromark/micromark\n\n[micromark-extension-citekey]: https://github.com/bernardjoseph/micromark-extension-citekey\n\n[traversal]: https://unifiedjs.com/learn/recipe/tree-traversal/\n\n[pandoc]: https://pandoc.org\n\n[pandoc-manual]: https://pandoc.org/MANUAL.html\n\n[pandoc-citation-syntax]: https://pandoc.org/MANUAL.html#citation-syntax\n\n[dfn-literal]: https://github.com/syntax-tree/mdast#literal\n\n[contributing]: https://github.com/unifiedjs/.github/blob/HEAD/contributing.md\n\n[support]: https://github.com/unifiedjs/.github/blob/HEAD/support.md\n\n[coc]: https://github.com/unifiedjs/.github/blob/HEAD/code-of-conduct.md\n\n[license]: https://github.com/micromark/micromark/blob/main/license\n","readmeFilename":"readme.md"}