{"id":13484035,"url":"https://github.com/remarkjs/remark-math","last_synced_at":"2025-05-14T03:06:50.877Z","repository":{"id":45007647,"uuid":"81942023","full_name":"remarkjs/remark-math","owner":"remarkjs","description":"remark and rehype plugins to support math","archived":false,"fork":false,"pushed_at":"2025-02-20T11:40:20.000Z","size":1133,"stargazers_count":410,"open_issues_count":0,"forks_count":62,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-09T10:02:41.931Z","etag":null,"topics":["html","katex","latex","markdown","math","rehype","rehype-plugin","remark","remark-plugin","tex"],"latest_commit_sha":null,"homepage":"https://remark.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/remarkjs.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2017-02-14T12:13:26.000Z","updated_at":"2025-04-02T03:41:22.000Z","dependencies_parsed_at":"2022-09-26T17:21:09.208Z","dependency_job_id":"7b47407d-6029-463d-8ace-55d9503ea069","html_url":"https://github.com/remarkjs/remark-math","commit_stats":{"total_commits":264,"total_committers":20,"mean_commits":13.2,"dds":"0.34090909090909094","last_synced_commit":"88a9497e1ede93b958237c85edbf5651faeca7af"},"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-math","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-math/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-math/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remarkjs%2Fremark-math/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remarkjs","download_url":"https://codeload.github.com/remarkjs/remark-math/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248191956,"owners_count":21062608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html","katex","latex","markdown","math","rehype","rehype-plugin","remark","remark-plugin","tex"],"created_at":"2024-07-31T17:01:18.365Z","updated_at":"2025-04-10T17:17:55.187Z","avatar_url":"https://github.com/remarkjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["JavaScript","Plugins"],"sub_categories":[],"readme":"# remark-math\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\nThis project is a monorepo that contains several packages for dealing with\nmath in markdown and HTML.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Examples](#examples)\n  * [Example: KaTeX](#example-katex)\n  * [Example: MathJax](#example-mathjax)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis repository contains [unified][] ([rehype][] and [remark][]) plugins to add\nsupport for math.\nYou can use them to add support for parsing and serializing a syntax extension\nand to render math with KaTeX or MathJax.\n\n* [`remark-math`][remark-math]\n  — remark plugin to support a math syntax in markdown\n* [`rehype-katex`][rehype-katex]\n  — rehype plugin to render math in HTML with [KaTeX][]\n* [`rehype-mathjax`][rehype-mathjax]\n  — rehype plugin to render math in HTML with [MathJax][]\n\nWhen dealing with markdown, you optionally use `remark-math`, or alternatively\nuse fenced code (` ```math `).\nThen, you either use `rehype-katex` or `rehype-mathjax` to render math in HTML.\n\nThere are also other plugins that work with `remark-math`.\nSuch as [`rehype-mathml`](https://github.com/Daiji256/rehype-mathml)\nwhich uses [`ronkok/Temml`](https://github.com/ronkok/Temml).\n\n## When should I use this?\n\nThis project is useful when you want to support LaTeX math.\nThis mechanism works well when you want authors, that have some LaTeX\nexperience, to be able to embed rich diagrams of math to scientific\ndocumentation.\nThe extra syntax extension supported by `remark-math` for math in markdown does\nnot work everywhere so it makes markdown less portable.\nThis project is also useful as it renders math with KaTeX or MathJax at compile\ntime, which means that there is no client side JavaScript needed.\n\n## Examples\n\n### Example: KaTeX\n\nSay our document `example.md` contains:\n\n```markdown\nLift($$L$$) can be determined by Lift Coefficient ($$C_L$$) like the following\nequation.\n\n$$\nL = \\frac{1}{2} \\rho v^2 S C_L\n$$\n```\n\n…and our module `example.js` contains:\n\n```js\nimport rehypeKatex from 'rehype-katex'\nimport rehypeStringify from 'rehype-stringify'\nimport remarkMath from 'remark-math'\nimport remarkParse from 'remark-parse'\nimport remarkRehype from 'remark-rehype'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkMath)\n  .use(remarkRehype)\n  .use(rehypeKatex)\n  .use(rehypeStringify)\n  .process(await read('example.md'))\n\nconsole.log(String(file))\n```\n\n…then running `node example.js` yields:\n\n```html\n\u003cp\u003eLift(\u003ccode class=\"language-math math-inline\"\u003e\u003cspan class=\"katex\"\u003e…\u003c/span\u003e\u003c/code\u003e) like the following\nequation.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-math math-display\"\u003e\u003cspan class=\"katex-display\"\u003e\u003cspan class=\"katex\"\u003e…\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\n```\n\n\u003e 👉 **Note**: KaTeX requires CSS to render correctly.\n\u003e Use `katex.css` somewhere on the page where the math is shown to style it\n\u003e properly:\n\u003e\n\u003e ```html\n\u003e \u003c!-- Get the latest one from: https://katex.org/docs/browser --\u003e\n\u003e \u003clink href=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css\" rel=\"stylesheet\"\u003e\n\u003e ```\n\n### Example: MathJax\n\nSupporting either MathJax or KaTeX is very similar.\nTake the above KaTeX example and change:\n\n```diff\n@@ -1,4 +1,4 @@\n-import rehypeKatex from 'rehype-katex'\n+import rehypeMathjax from 'rehype-mathjax'\n import rehypeStringify from 'rehype-stringify'\n import remarkMath from 'remark-math'\n import remarkParse from 'remark-parse'\n@@ -10,7 +10,7 @@ const file = await unified()\n   .use(remarkParse)\n   .use(remarkMath)\n   .use(remarkRehype)\n-  .use(rehypeKatex)\n+  .use(rehypeMathjax)\n   .use(rehypeStringify)\n   .process(await read('example.md'))\n```\n\n…then running `node example.js` yields:\n\n```html\n\u003cp\u003eLift(\u003cmjx-container class=\"MathJax\" jax=\"SVG\"\u003e\u003c!--…--\u003e\u003c/mjx-container\u003e) can be determined by Lift Coefficient (\u003cmjx-container class=\"MathJax\" jax=\"SVG\"\u003e\u003c!--…--\u003e\u003c/mjx-container\u003e) like the following\nequation.\u003c/p\u003e\n\u003cmjx-container class=\"MathJax\" jax=\"SVG\" display=\"true\"\u003e\u003c!--…--\u003e\u003c/mjx-container\u003e\u003cstyle\u003e\nmjx-container[jax=\"SVG\"] {\n  direction: ltr;\n}\n/* … */\n\u003c/style\u003e\n```\n\n## Security\n\nAssuming you trust KaTeX/MathJax, using `rehype-katex`/`rehype-mathjax` is\nsafe.\nIf a vulnerability is introduced in them, it opens you up to a\n[cross-site scripting (XSS)][wiki-xss] attack.\nSee their readmes for more info.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways\nto 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] © [Junyoung Choi][author] and Taniguchi Masaya\n\n\u003c!-- Definitions --\u003e\n\n[author]: https://rokt33r.github.io\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[build]: https://github.com/remarkjs/remark-math/actions\n\n[build-badge]: https://github.com/remarkjs/remark-math/workflows/main/badge.svg\n\n[chat]: https://github.com/remarkjs/remark/discussions\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md\n\n[collective]: https://opencollective.com/unified\n\n[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md\n\n[coverage]: https://codecov.io/github/remarkjs/remark-math\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-math.svg\n\n[downloads]: https://www.npmjs.com/package/remark-math\n\n[downloads-badge]: https://img.shields.io/npm/dm/remark-math.svg\n\n[health]: https://github.com/remarkjs/.github\n\n[katex]: https://github.com/Khan/KaTeX\n\n[license]: license\n\n[mathjax]: https://mathjax.org/\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[rehype-katex]: ./packages/rehype-katex/\n\n[rehype-mathjax]: ./packages/rehype-mathjax/\n\n[remark]: https://github.com/remarkjs/remark\n\n[remark-math]: ./packages/remark-math/\n\n[size]: https://bundlejs.com/?q=remark-math\n\n[size-badge]: https://img.shields.io/bundlejs/size/remark-math\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md\n\n[unified]: https://github.com/unifiedjs/unified\n\n[wiki-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkjs%2Fremark-math","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremarkjs%2Fremark-math","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremarkjs%2Fremark-math/lists"}