{"_id":"@benrbray/rehype-cite","name":"@benrbray/rehype-cite","dist-tags":{"latest":"2.0.1-alpha.5"},"versions":{"2.0.1-alpha.5":{"name":"@benrbray/rehype-cite","version":"2.0.1-alpha.5","license":"MIT","private":false,"description":"A `rehype` plugin for rendering citations and bibliographies.","repository":{"type":"git","url":"git+https://github.com/benrbray/remark-cite.git","directory":"remark-cite"},"keywords":["markdown","pandoc","citations","bibliography","rehype","rehype-plugin"],"author":{"name":"Benjamin R. Bray","url":"https://benrbray.com/"},"type":"module","exports":{".":"./dist/rehype-cite.js"},"types":"dist/rehype-cite.d.ts","dependencies":{"biblatex-csl-converter":"^2.1.0","unist-util-visit":"^5.0.0"},"peerDependencies":{"rehype":"^13.0.1","@benrbray/remark-cite":"2.0.1-alpha.4"},"devDependencies":{"@types/hast":"^3.0.4","@types/node":"^20.14.2","dedent-js":"^1.0.1","del-cli":"^5.1.0","katex":"^0.16.10","rehype-katex":"^7.0.0","rehype-sanitize":"^6.0.0","rehype-stringify":"^10.0.0","remark":"^15.0.1","remark-math":"^6.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0","solid-js":"^1.8.15","typescript":"^5.2.2","unified":"^11.0.4","vfile":"^6.0.1","vite":"^5.2.0","vite-plugin-dts":"^3.9.1","vite-plugin-solid":"^2.10.2","vite-tsconfig-paths":"^4.3.2","@benrbray/mdast-util-cite":"2.0.1-alpha.4"},"scripts":{"dev":"vite --config vite.config.dev.ts","dev:preview":"vite --config vite.config.dev.ts preview","build:check":"tsc","build:lib":"vite --config vite.config.lib.ts build","build":"pnpm run build:check && pnpm run build:lib","clean":"pnpm del dist","publish-pnpm":"pnpm publish"},"bugs":{"url":"https://github.com/benrbray/remark-cite/issues"},"homepage":"https://github.com/benrbray/remark-cite#readme","_id":"@benrbray/rehype-cite@2.0.1-alpha.5","_integrity":"sha512-ORlhCtjvnHivK1ivcII86tX/khz4e8+VKhlxj0d8VhMdaTVu4BhkELqd3BzaoknT+HzGumQvH6i74HjPOK+nEA==","_resolved":"/tmp/89e8d190d30b7aba2e688c54051d8098/benrbray-rehype-cite-2.0.1-alpha.5.tgz","_from":"file:benrbray-rehype-cite-2.0.1-alpha.5.tgz","_nodeVersion":"20.11.1","_npmVersion":"10.4.0","dist":{"integrity":"sha512-ORlhCtjvnHivK1ivcII86tX/khz4e8+VKhlxj0d8VhMdaTVu4BhkELqd3BzaoknT+HzGumQvH6i74HjPOK+nEA==","shasum":"5b1572c1665986801925379b990f2cb68eb3547b","tarball":"https://registry.npmjs.org/@benrbray/rehype-cite/-/rehype-cite-2.0.1-alpha.5.tgz","fileCount":17,"unpackedSize":170760,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDmWGOmQGwctOEj8Zv+noJnbDjcsFwIxyCYGn1U1PdiZAiEApl2mCyo+wIgDkZxDkqa4D+exQVLW6bOm6R+hdT1+mZQ="}]},"_npmUser":{"name":"benrbray","email":"benrbray@gmail.com"},"directories":{},"maintainers":[{"name":"benrbray","email":"benrbray@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-cite_2.0.1-alpha.5_1720685989618_0.05679044249804743"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-11T08:19:49.498Z","2.0.1-alpha.5":"2024-07-11T08:19:49.786Z","modified":"2024-07-11T08:19:50.093Z"},"maintainers":[{"name":"benrbray","email":"benrbray@gmail.com"}],"description":"A `rehype` plugin for rendering citations and bibliographies.","homepage":"https://github.com/benrbray/remark-cite#readme","keywords":["markdown","pandoc","citations","bibliography","rehype","rehype-plugin"],"repository":{"type":"git","url":"git+https://github.com/benrbray/remark-cite.git","directory":"remark-cite"},"author":{"name":"Benjamin R. Bray","url":"https://benrbray.com/"},"bugs":{"url":"https://github.com/benrbray/remark-cite/issues"},"license":"MIT","readme":"# `rehype-cite`\n\nThe `rehype-cite` package is a `rehype` plugin adding support for inline citations and bibliographies.\n\nFor now, `rehype-cite` is not capable of producing citations that adhere strictly to well-known bibliography formats like APA, MLA, IEEE, etc..  You should only use `rehype-cite` in non-academic contexts like blog posts or note-taking.\n\n> [!IMPORTANT]\n> If you have strict formatting requirements, consider using [rehype-citation](https://github.com/timlrx/rehype-citation) or [citeproc-js](https://citeproc-js.readthedocs.io/en/latest/) instead, for compatibility with the [Citation Style Language](https://citationstyles.org/).\n\n## Installation\n\n```bash\nnpm install @benrbray/rehype-cite\n```\n\n## Usage\n\n```typescript\nconst bibFile = `\n@book{riehl2017:category,\n  title={Category theory in context},\n  author={Riehl, Emily},\n  year={2017},\n  publisher={Courier Dover Publications},\n  url={https://store.doverpublications.com/048680903x.html}\n}\n`;\n\nconst processor = unified()\n  .use(remarkParse)\n  .use(remarkMath)\n  .use(remarkCite)\n  .use(remarkRehype)\n  .use(rehypeKatex)\n  .use(rehypeCite, { bibFiles : [bibFile] })\n  .use(rehypeStringify);\n\nconst markdown = \"[@riehl2017:category]\";\nconst result: string = processor.processSync(markdown).toString();\n```\n\n## Goals\n\nWhen using `rehype-cite`, you will quickly notice that the citations produced by `rehype-cite` do not adhere to any standard citation format (such as APA, MLA, Harvard, etc.).  \n\nExisting JavaScript libraries for citation rendering (such as [`citation-js`]() and [`citeproc-js`](https://citeproc-js.readthedocs.io/en/latest/)) support a great many citation styles in [CSL format](https://citationstyles.org/), but unfortunately are designed to produce only *strings* rather than structured output like HTML or JSON.  This makes it difficult to add interactivity such as hyperlinked titles to bibliography entries.\n\nInstead, `rehype-cite` includes a custom formatter which produces **structured output** convenient for styling, hyperlinking, and further postprocessing of bibliography data.  The final citations are \"good enough\" for use in contexts like blog posts or personal notes, but should **not** be used in formal academic contexts.\n\n## Writing a Custom Formatter (*experimental*)\n\nIn addition to the built-in formatter, `rehype-cite` includes a DSL for writing new formatters.\n\n## Resources\n\n* [BibLaTeX Cheat Sheet](https://tug.ctan.org/info/biblatex-cheatsheet/biblatex-cheatsheet.pdf)","readmeFilename":"README.md"}