{"_id":"@benrbray/micromark-extension-cite","_rev":"4-01e33ad49ae6dfd02ee3ef9bf398575f","name":"@benrbray/micromark-extension-cite","dist-tags":{"latest":"2.0.1-alpha.1"},"versions":{"1.0.0":{"name":"@benrbray/micromark-extension-cite","version":"1.0.0","keywords":["markdown","pandoc","citations","bibliography","remark","remark-plugin","micromark","micromark-plugin","micromark-extension"],"author":{"url":"https://benrbray.com/","name":"Benjamin R. Bray"},"license":"MIT","_id":"@benrbray/micromark-extension-cite@1.0.0","maintainers":[{"name":"benrbray","email":"benrbray@gmail.com"}],"homepage":"https://github.com/benrbray/remark-cite#readme","bugs":{"url":"https://github.com/benrbray/remark-cite/issues"},"dist":{"shasum":"612e24cb104275e451f85410f4f24ba6274bdc05","tarball":"https://registry.npmjs.org/@benrbray/micromark-extension-cite/-/micromark-extension-cite-1.0.0.tgz","fileCount":14,"integrity":"sha512-MiqLxAr6/+sslKOgsuAGOHIWFUyw9umL5GzBijPqMp/pcidOgeCzC1Sb8KT3pq0XyB3gYuQQjgEnXNDjQrJ/Wg==","signatures":[{"sig":"MEYCIQCiW3xAlYZTN+BLvi6DyZljOoJBx6Pcn8VclGjfkibssQIhAIzSxd2KQi4ASLghncexX8i95R08xWkXqESOVjLf8iuA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":139767,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglmNVCRA9TVsSAnZWagAAwVMQAJlzrVrlsS+2YTZMhd9V\nyODoFYJqY0B5e4jwAdvJL8X+guBEG0Jn99jmQ16JjI25thrEDwojswsoDwN+\npUYEJzNR32flHMPvSF/IbNcv6mtQ5zI5vZmlT3PuwOgvaVl4ikrKF+yibbmg\nIjea/avNpl3GwF1f49vIfkWF6EMzsneVq4U+tiWQOVMymazvfCjw6xjeFKfq\n6eYto3ipUq1+6QzgJud1gHTLNCifaQwkEeDz/AlejZwBiPDHSB3mWgSNMzxJ\nzR2r5m4Kk8TeHLPPKE7Gu/HjFWyANa4095LT4UbhIPMFNde77Znj4TaBUNWE\neWklFFDYaAOQkLHgLLSx3goCnkeJeXGbiwZqE4/sSjFgC+UWhbIjv366CXWM\nsHaSC18YE7VTO/XycV0xuPv/PgZF7iSXLFi3By5O8JbW7/drDswcaeb3BNOE\nVNUPx2r4VkSqME61zzlrm61dXBmSYVIt3QyMfXSjjkzmJL3fSMIp+zqj71H8\ntjDpKEoqE9akUDQs1AaDt6fL9bjCCJQ4tqWUTDeT9Av2ZRVw5O5l2czMHDOQ\naNlr+EMCPAXu+9K09YLiFiHitNI5EJFHf50C8C88Egi9QiYmYxHFjOfzzYTl\nTQomtRCN26QdaZLAKPtcRQaM0REGGqbz1nqGYW8Hv/1KzOvnVSZL0i+wx86h\nC9ch\r\n=bHV7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.cjs.js","module":"dist/index.esm.js","browser":"dist/index.umd.js","private":false,"scripts":{"test":"env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register 'test/**/*.ts'","build":"rollup -c","clean":"npx del dist","prepare":"npm run clean; npm run build","pretest":"npm run clean; npm run build"},"_npmUser":{"name":"benrbray","email":"benrbray@gmail.com"},"repository":{"url":"git+https://github.com/benrbray/remark-cite.git","type":"git","directory":"micromark-extension-cite"},"_npmVersion":"7.11.2","description":"Micromark syntax extension for pandoc-style citations.","directories":{},"_nodeVersion":"14.16.1","dependencies":{"micromark":"^2.11.4"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^8.3.2","lodash":"^4.17.21","rollup":"^2.47.0","del-cli":"^3.0.1","ts-node":"^9.1.1","unified":"^9.2.1","@types/mocha":"^8.2.2","@types/lodash":"^4.14.168","@rollup/plugin-babel":"^5.3.0","@rollup/plugin-commonjs":"^18.1.0","@wessberg/rollup-plugin-ts":"^1.3.14","@babel/plugin-transform-runtime":"^7.13.15"},"_npmOperationalInternal":{"tmp":"tmp/micromark-extension-cite_1.0.0_1620468565008_0.4094769314831468","host":"s3://npm-registry-packages"}},"2.0.0-alpha.0":{"name":"@benrbray/micromark-extension-cite","version":"2.0.0-alpha.0","keywords":["markdown","pandoc","citations","bibliography","remark","remark-plugin","micromark","micromark-plugin","micromark-extension"],"author":{"url":"https://benrbray.com/","name":"Benjamin R. Bray"},"license":"MIT","_id":"@benrbray/micromark-extension-cite@2.0.0-alpha.0","maintainers":[{"name":"benrbray","email":"benrbray@gmail.com"}],"homepage":"https://github.com/benrbray/remark-cite#readme","bugs":{"url":"https://github.com/benrbray/remark-cite/issues"},"dist":{"shasum":"2b0410cecbeb2d6c0cf151799e65e86b762b1208","tarball":"https://registry.npmjs.org/@benrbray/micromark-extension-cite/-/micromark-extension-cite-2.0.0-alpha.0.tgz","fileCount":6,"integrity":"sha512-5ZbLJ300G02WCdN8RMR2syWZQtuNOQnCItmduIX0Cpvg7sm+wPqLh6cTxAUggjUHjZVlPsL6DR5nGXL+uGxxVg==","signatures":[{"sig":"MEUCIQD/e7gNUKmJGGbcWk1xYJEnYCb9VplAdSYrDivFxviylQIgZGPIJsiZ3EjP4eakUM3up7nLtIjocrADji8fwXZmv1Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28152},"type":"module","types":"dist/micromark-extension-cite.d.ts","exports":{".":"./dist/micromark-extension-cite.js"},"gitHead":"71a00ab5a1886a05e2d3ce3178b575bae600e6df","private":false,"scripts":{"dev":"vite","test":"vitest","build":"tsc && vite build","clean":"pnpm del dist","prepare":"pnpm run clean; pnpm run build","pretest":"pnpm run clean; pnpm run build","preview":"vite preview"},"_npmUser":{"name":"benrbray","email":"benrbray@gmail.com"},"repository":{"url":"git+https://github.com/benrbray/remark-cite.git","type":"git","directory":"micromark-extension-cite"},"_npmVersion":"10.4.0","description":"Micromark syntax extension for pandoc-style citations.","directories":{},"_nodeVersion":"20.11.1","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.0","vitest":"^1.6.0","del-cli":"^5.1.0","typescript":"^5.2.2","vite-plugin-dts":"^3.9.1","vite-tsconfig-paths":"^4.3.2","micromark-util-types":"^2.0.0"},"peerDependencies":{"micromark":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/micromark-extension-cite_2.0.0-alpha.0_1720626720958_0.10828205893143794","host":"s3://npm-registry-packages"}},"2.0.0-alpha.1":{"name":"@benrbray/micromark-extension-cite","version":"2.0.0-alpha.1","keywords":["markdown","pandoc","citations","bibliography","remark","remark-plugin","micromark","micromark-plugin","micromark-extension"],"author":{"url":"https://benrbray.com/","name":"Benjamin R. Bray"},"license":"MIT","_id":"@benrbray/micromark-extension-cite@2.0.0-alpha.1","maintainers":[{"name":"benrbray","email":"benrbray@gmail.com"}],"homepage":"https://github.com/benrbray/remark-cite#readme","bugs":{"url":"https://github.com/benrbray/remark-cite/issues"},"dist":{"shasum":"62218b09fc075f8a66b8bfc122cac21c359cdd97","tarball":"https://registry.npmjs.org/@benrbray/micromark-extension-cite/-/micromark-extension-cite-2.0.0-alpha.1.tgz","fileCount":7,"integrity":"sha512-f5vpHwQSdggm3cwnYVqL071ncTzXFP3AfowE98N5ghGmjLngFXvfFUv9QAHxa6ksz18jSdUfFRfCx+Uvi4Ztfw==","signatures":[{"sig":"MEUCIQDiTTWTllYdjN9JJu+mvUmVVfm+FKHeugaCv0nmT4A/fQIgdWyf3uvn8V4SGP6asUXn9Likzof9y6p8zPt+2s7hKQA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":29187},"type":"module","_from":"file:benrbray-micromark-extension-cite-2.0.0-alpha.1.tgz","types":"dist/micromark-extension-cite.d.ts","exports":{".":"./dist/micromark-extension-cite.js"},"private":false,"scripts":{"dev":"vite","test":"vitest","build":"tsc && vite build","clean":"pnpm del dist","pretest":"pnpm run clean; pnpm run build","preview":"vite preview"},"_npmUser":{"name":"benrbray","email":"benrbray@gmail.com"},"_resolved":"/tmp/fb6b657f1d5f9129adbcb4bc528c89dc/benrbray-micromark-extension-cite-2.0.0-alpha.1.tgz","_integrity":"sha512-f5vpHwQSdggm3cwnYVqL071ncTzXFP3AfowE98N5ghGmjLngFXvfFUv9QAHxa6ksz18jSdUfFRfCx+Uvi4Ztfw==","repository":{"url":"git+https://github.com/benrbray/remark-cite.git","type":"git","directory":"micromark-extension-cite"},"_npmVersion":"10.4.0","description":"Micromark syntax extension for pandoc-style citations.","directories":{},"_nodeVersion":"20.11.1","_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.0","vitest":"^1.6.0","del-cli":"^5.1.0","typescript":"^5.2.2","vite-plugin-dts":"^3.9.1","vite-tsconfig-paths":"^4.3.2","micromark-util-types":"^2.0.0"},"peerDependencies":{"micromark":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/micromark-extension-cite_2.0.0-alpha.1_1720627383296_0.25043294281725803","host":"s3://npm-registry-packages"}},"2.0.1-alpha.1":{"name":"@benrbray/micromark-extension-cite","version":"2.0.1-alpha.1","license":"MIT","private":false,"description":"Micromark syntax extension for pandoc-style citations.","repository":{"type":"git","url":"git+https://github.com/benrbray/remark-cite.git","directory":"micromark-extension-cite"},"keywords":["markdown","pandoc","citations","bibliography","remark","remark-plugin","micromark","micromark-plugin","micromark-extension"],"author":{"name":"Benjamin R. Bray","url":"https://benrbray.com/"},"type":"module","exports":{".":"./dist/micromark-extension-cite.js"},"types":"dist/micromark-extension-cite.d.ts","peerDependencies":{"micromark":"^4.0.0"},"devDependencies":{"del-cli":"^5.1.0","micromark-util-types":"^2.0.0","typescript":"^5.2.2","vite":"^5.2.0","vite-plugin-dts":"^3.9.1","vite-tsconfig-paths":"^4.3.2","vitest":"^1.6.0"},"scripts":{"dev":"vite","build":"tsc && vite build","clean":"pnpm del dist","pretest":"pnpm run clean; pnpm run build","preview":"vite preview","test":"vitest","publish-pnpm":"pnpm publish"},"bugs":{"url":"https://github.com/benrbray/remark-cite/issues"},"homepage":"https://github.com/benrbray/remark-cite#readme","_id":"@benrbray/micromark-extension-cite@2.0.1-alpha.1","_integrity":"sha512-5/YdMl1lg28nSmMhUdCJm3C8SdElWymsEwPqA66NFlj0VNv23nAUL8Rgm92Gp0SLudKFbQmm+v041FgubG9Pug==","_resolved":"/tmp/a5f0107e93d322a4416938be8cc11373/benrbray-micromark-extension-cite-2.0.1-alpha.1.tgz","_from":"file:benrbray-micromark-extension-cite-2.0.1-alpha.1.tgz","_nodeVersion":"20.11.1","_npmVersion":"10.4.0","dist":{"integrity":"sha512-5/YdMl1lg28nSmMhUdCJm3C8SdElWymsEwPqA66NFlj0VNv23nAUL8Rgm92Gp0SLudKFbQmm+v041FgubG9Pug==","shasum":"9bb0e2b3d80fdb9515653b90803d8ac3b6b14a99","tarball":"https://registry.npmjs.org/@benrbray/micromark-extension-cite/-/micromark-extension-cite-2.0.1-alpha.1.tgz","fileCount":7,"unpackedSize":29223,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDSAeOHshUYJ4ori9SlvSOpvqvjUfIFsFKieEGQXDYHTgIhAJqRYXZTFseXPcfuHn/H4n8RmaTmC577HdjfWuozcMGl"}]},"_npmUser":{"name":"benrbray","email":"benrbray@gmail.com"},"directories":{},"maintainers":[{"name":"benrbray","email":"benrbray@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/micromark-extension-cite_2.0.1-alpha.1_1720628501623_0.9346887605101639"},"_hasShrinkwrap":false}},"time":{"created":"2021-05-08T10:09:24.948Z","modified":"2024-07-10T16:21:41.946Z","1.0.0":"2021-05-08T10:09:25.157Z","2.0.0-alpha.0":"2024-07-10T15:52:01.103Z","2.0.0-alpha.1":"2024-07-10T16:03:03.415Z","2.0.1-alpha.1":"2024-07-10T16:21:41.779Z"},"bugs":{"url":"https://github.com/benrbray/remark-cite/issues"},"author":{"name":"Benjamin R. Bray","url":"https://benrbray.com/"},"license":"MIT","homepage":"https://github.com/benrbray/remark-cite#readme","keywords":["markdown","pandoc","citations","bibliography","remark","remark-plugin","micromark","micromark-plugin","micromark-extension"],"repository":{"type":"git","url":"git+https://github.com/benrbray/remark-cite.git","directory":"micromark-extension-cite"},"description":"Micromark syntax extension for pandoc-style citations.","maintainers":[{"name":"benrbray","email":"benrbray@gmail.com"}],"readme":"# `micromark-extension-cite`\n\n[![](https://img.shields.io/npm/v/@benrbray/micromark-extension-cite?style=flat-square)](https://www.npmjs.com/package/@benrbray/micromark-extension-cite)\n![license](https://img.shields.io/github/license/benrbray/remark-cite?style=flat-square)\n\nA **[`micromark`](https://github.com/micromark/micromark)** syntax extension for [`pandoc`-style](https://pandoc.org/MANUAL.html#extension-citations) citations, providing the low-level modules for integrating with the micromark tokenizer and the micromark HTML compiler.\n\nYou probably shouldn’t use this package directly, but instead use [`mdast-util-cite`](https://github.com/benrbray/remark-cite/tree/master/mdast-util-cite) with [mdast](https://github.com/syntax-tree/mdast) or [`remark-cite`](https://github.com/benrbray/remark-cite/tree/master/remark-cite) with [remark](https://github.com/remarkjs/remark).\n\n## Install\n\nInstall [`@benrbray/micromark-extension-cite`]() on `npm`.\n\n```\nnpm install @benrbray/micromark-extension-cite \n```\n\n## Usage\n\n```javascript\nimport micromark from \"micromark\";\nimport { citeSyntax, citeHtml } from \"micromark-extension-cite\";\n\nlet serialized = micromark('[see @wadler1989, sec. 1.3; and @hughes1990, pp.4]', {\n    extensions: [citeSyntax()],\n    htmlExtensions: [citeHtml()]\n});\n```\n\nThe serialized result will be the following.  To get an abstract syntax tree, use `mdast-util-cite` instead.\n\n```html\n<p><span class=\"citation\" data-cites=\"wadler1989 hughes1990\">\n[see @wadler1989, sec. 1.3; and @hughes1990, pp.4]\n</span></p>\n```\n\n### Configuration Options\n\n#### `options.enablePandocSyntax [boolean]`\n\nEnable the pandoc-style syntax, `[@wadler1989]`.  A single citation can cite multiple items, and each individual item can have a prefix and suffix.  The default is `true`.  Authors can be suppressed with a hyphen `-`.\n\n#### `options.enableAltSyntax [boolean]`\n\nEnable the alternative syntax, `@[wadler1989]`.  A single citation can site multiple items, but the first item cannot have a prefix.  Authors can be suppressed with a hyphen `-`.\n\n## Syntax\n\nBy default, this extension supports `pandoc`-style syntax, where each citation item can have a prefix, suffix, and key.  Include a hyphen `-` before an `@` symbol to indicate that the author name should be suppressed.\n\n```\n[@wadler1989:comprehending-monads]\n[see @wadler1989, pp. 80; and @hughes1990; also @peyton-jones2003]\n[-@wadler1989; and @hughes1990]\n```\n\nWith the `enableAltSyntax` option, you can place the first `@` symbol before the opening bracket.  When using the alternative syntax, the first item cannot have a prefix.  The first item *can* be suppressed with a leading hyphen `-`.\n\n```\n@[wadler1989:comprehending-monads]\n@[wadler1989, pp. 80; and @hughes1990; but don't forget @peyton-jones2003]\n@[-wadler1989; and @hughes1990]\n```\n\n### Railroad Diagrams\n\nA `micromark` syntax extension is basically a state machine that operates on a character stream to produce a stream of tokens that can later be assembled into a syntax tree by `mdast`.  The following diagrams, produced by [`grammkit`](https://dundalek.com/grammkit), give a rough sketch of the state machine:\n\n**Pandoc Syntax**\n\n![pandoc syntax](docs/cite-syntax-pandoc.png)\n\n**Alternate Syntax**\n\n![alternate syntax](docs/cite-syntax-alt.png)\n\nOf course, since the code for this extension was written by hand, rather than by a parser generator, the correspondence is not exact.  A future project might be to convert PEG grammars to `micromark` syntax extensions, in an attempt to escape the third and fourth certainties in life:  bugs and boilerplate. :)\n\n## Differences from `pandoc`\n\nMostly to reduce complexity, the syntax supported by this extension differs from [`pandoc` citation syntax](https://pandoc.org/MANUAL.html#extension-citations) in the following ways:\n\n* To avoid recognizing email addresses as citations, we require the prefix, when it exists, to end with a space character.\n* Unlike Pandoc, we make no distinction between the \"locator\" and \"suffix\".\n\nThese choices are not set in stone, so feel free to open an issue to discuss possible changes.","readmeFilename":"README.md"}