{"id":26499680,"url":"https://github.com/daiji256/rehype-mathml","last_synced_at":"2025-07-24T08:33:35.952Z","repository":{"id":262943372,"uuid":"878418783","full_name":"Daiji256/rehype-mathml","owner":"Daiji256","description":"rehype plugin to render math with MathML","archived":false,"fork":false,"pushed_at":"2025-02-19T13:06:04.000Z","size":153,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T10:12:20.190Z","etag":null,"topics":["hast","html","latex","markdown","math","rehype","rehype-plugin","temml","tex","unified"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@daiji256/rehype-mathml","language":"TypeScript","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/Daiji256.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}},"created_at":"2024-10-25T11:04:40.000Z","updated_at":"2025-02-19T13:05:38.000Z","dependencies_parsed_at":"2024-11-15T07:18:43.798Z","dependency_job_id":"976dedbf-14bf-42d3-8889-2ba46397d6be","html_url":"https://github.com/Daiji256/rehype-mathml","commit_stats":null,"previous_names":["daiji256/rehype-mathml"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daiji256%2Frehype-mathml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daiji256%2Frehype-mathml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daiji256%2Frehype-mathml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daiji256%2Frehype-mathml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Daiji256","download_url":"https://codeload.github.com/Daiji256/rehype-mathml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244637102,"owners_count":20485446,"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":["hast","html","latex","markdown","math","rehype","rehype-plugin","temml","tex","unified"],"created_at":"2025-03-20T15:18:28.717Z","updated_at":"2025-07-24T08:33:35.924Z","avatar_url":"https://github.com/Daiji256.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @daiji256/rehype-mathml\n\n[![npm version](https://img.shields.io/npm/v/@daiji256/rehype-mathml.svg)](https://www.npmjs.com/package/@daiji256/rehype-mathmle)\n[![npm downloads](https://img.shields.io/npm/dm/@daiji256/rehype-mathml.svg)](https://www.npmjs.com/package/@daiji256/rehype-mathml)\n\n**[rehype][]** plugin to render math with MathML by\nconverting LaTeX math to MathML using temml.\nThe reason for using [temml][] is that it is a lightweight library\nwith a wide coverage of LaTeX functions.\n\n## Contents\n\n- [Contents](#contents)\n- [What is this?](#what-is-this)\n- [When should I use this?](#when-should-i-use-this)\n- [Install](#install)\n- [Use](#use)\n- [API](#api)\n  - [`unified().use(rehypeMathML[, options])`](#unifieduserehypemathml-options)\n  - [`Options`](#options)\n- [Markdown](#markdown)\n- [HTML](#html)\n- [Types](#types)\n- [License](#license)\n\n## What is this?\n\nThis package is a [unified][] ([rehype][]) plugin to render math with MathML.\nYou can add classes to HTML elements, use fenced code in markdown, or combine\nwith [`remark-math`][remark-math] for a `$C$` syntax extension.\n\n## When should I use this?\n\nThis project is useful as it renders math with MathML at compile time,\nwhich means that no client-side JavaScript or images are needed.\n\nThis plugin is the MathML version of other plugins like\n[`rehype-mathjax`][rehype-mathjax] (renders with MathJax) and\n[`rehype-katex`][rehype-katex] (renders with KaTeX).\nWith MathML, the HTML becomes simpler and lighter.\nAdditionally, it supports the use of math fonts like [Noto Math][note-math].\n\n## Install\n\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install @daiji256/rehype-mathml\n```\n\nTo ensure proper rendering of mathematical expressions in every browser, you need to add [`Temml.woff2` and `Temml-*.css`][temml-dist].\n\n## Use\n\nSay our document `input.html` contains:\n\n```html\n\u003cp\u003e\n  Lift(\u003ccode class=\"language-math\"\u003eL\u003c/code\u003e) can be determined by Lift\n  Coefficient (\u003ccode class=\"language-math\"\u003eC_L\u003c/code\u003e) like the following\n  equation.\n\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-math\"\u003e\n  L = \\frac{1}{2} \\rho v^2 S C_L\n\u003c/code\u003e\u003c/pre\u003e\n```\n\n…and our module `example.js` contains:\n\n```js\nimport { unified } from 'unified';\nimport rehypeParse from 'rehype-parse';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeMathML from '@daiji256/rehype-mathml';\nimport { read, write } from 'to-vfile';\n\nconst file = await unified()\n  .use(rehypeParse, { fragment: true })\n  .use(rehypeMathML)\n  .use(rehypeStringify)\n  .process(await read('input.html'));\n\nfile.basename = 'output.html';\nawait write(file);\n```\n\n…then running `node example.js` creates an `output.html` with:\n\n```html\n\u003cp\u003e\n  Lift(\u003cmath\u003e\u003c!--…--\u003e\u003c/math\u003e) can be determined by Lift\n  Coefficient (\u003cmath\u003e\u003c!--…--\u003e\u003c/math\u003e) like the following\n  equation.\n\u003c/p\u003e\n\u003cmath display=\"block\" class=\"tml-display\" style=\"display:block math;\"\u003e\u003c!--…--\u003e\u003c/math\u003e\n```\n\n…open `output.html` in a browser to see the rendered math.\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`rehypeMathML`](#unifieduserehypemathml-options).\n\n### `unified().use(rehypeMathML[, options])`\n\nRender elements with a `language-math` (or `math-display`, `math-inline`)\nclass with [MathML][].\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n```ts\nimport type { Options as TemmlOptions } from 'temml';\n\ntype Options = Partial\u003cTemmlOptions\u003e;\n```\n\nSee [_Options_ on `temml.org`][temml-options] for more info.\n\n## Markdown\n\nThis plugin supports the syntax extension enabled by\n[`remark-math`][remark-math].\nIt also supports math generated by using fenced code:\n\n````markdown\n```math\nC_L\n```\n````\n\n## HTML\n\nThe content of any element with a `language-math`, `math-inline`, or\n`math-display` class is transformed.\nThe elements are replaced by MathML transformed by temml.\nEither a `math-display` class or using `\u003cpre\u003e\u003ccode class=\"language-math\"\u003e` will\nresult in “display” math: math that is a block on its own line.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`](#options).\n\n## License\n\n[MIT][license] © [Daiji256][author]\n\n\u003c!-- Definitions --\u003e\n\n[mathml]: https://www.w3.org/Math/\n[temml]: https://temml.org/\n[temml-options]: https://temml.org/docs/en/administration#options\n[temml-dist]: https://github.com/ronkok/Temml/tree/main/dist\n[unified]: https://github.com/unifiedjs/unified\n[rehype]: https://github.com/rehypejs/rehype\n[remark-math]: https://github.com/remarkjs/remark-math/tree/main/packages/remark-math\n[rehype-mathjax]: https://github.com/remarkjs/remark-math/tree/main/packages/rehype-mathjax\n[rehype-katex]: https://github.com/remarkjs/remark-math/tree/main/packages/rehype-katex\n[npm]: https://docs.npmjs.com/cli/install\n[typescript]: https://www.typescriptlang.org\n[note-math]: https://github.com/notofonts/math\n[license]: LICENSE\n[author]: https://github.com/Daiji256\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaiji256%2Frehype-mathml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaiji256%2Frehype-mathml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaiji256%2Frehype-mathml/lists"}