{"_id":"remark-math-extended","_rev":"3-644a9c8bf2adb9c33b06825b9347731e","name":"remark-math-extended","dist-tags":{"latest":"6.1.1"},"versions":{"6.1.0":{"name":"remark-math-extended","version":"6.1.0","keywords":["katex","latex","markdown","math","mdast","plugin","remark","remark-plugin","tex","unified"],"author":{"url":"https://angelrose.org","name":"Jerry Ho","email":"jerrynh770@gmail.com"},"license":"MIT","_id":"remark-math-extended@6.1.0","maintainers":[{"name":"nh770","email":"jerrynh770@gmail.com"}],"contributors":[{"url":"https://angelrose.org","name":"Jerry Ho","email":"jerrynh770@gmail.com"},{"url":"https://rokt33r.github.io","name":"Junyoung Choi","email":"fluke8259@gmail.com"},{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"homepage":"https://github.com/Jerrynh770/remark-math-extended#readme","bugs":{"url":"https://github.com/Jerrynh770/remark-math-extended/issues"},"xo":{"rules":{"logical-assignment-operators":"off"},"prettier":true},"dist":{"shasum":"a3f4265b5d3999510ff01e063d45235817d08b80","tarball":"https://registry.npmjs.org/remark-math-extended/-/remark-math-extended-6.1.0.tgz","fileCount":9,"integrity":"sha512-AJyeFG26v/BFa18AqOy/g9PBLjGR9aLd9K63VG/F6HDshgavGmPMrObBidEjhIDHdEaPRspN++uGfoD5aZHYLw==","signatures":[{"sig":"MEUCIFIyE91wG9ny1nVqhLsQOwzjRaamWXBirTR6oQ9y/d6LAiEAkMMojZT1BnsmC14MdibEcaYSY4BhbFDXz1VopmsCUZw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16363},"type":"module","types":"./index.d.ts","exports":"./index.js","gitHead":"9e3247e082d0c406c03331471e0ee429eaa2d860","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","test-api":"node --conditions development test.js","test-coverage":"c8 --100 --reporter lcov -- npm run test-api"},"_npmUser":{"name":"nh770","email":"jerrynh770@gmail.com"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/Jerrynh770/remark-math-extended.git","type":"git"},"_npmVersion":"10.9.0","description":"Remark plugin that parses and stringifies math including \\(...\\) and \\[...\\]","directories":{},"sideEffects":false,"_nodeVersion":"22.15.1","dependencies":{"unified":"^11.0.0","@types/mdast":"^4.0.0","mdast-util-math":"^3.0.0","micromark-extension-math-extended":"^3.0.0"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","xo":"^0.60.0","unified":"^11.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","typescript":"^5.0.0","@types/node":"^22.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.0.0","type-coverage":"^2.0.0","rehype-stringify":"^10.0.0","remark-stringify":"^11.0.0","remark-preset-wooorm":"^11.0.0","unist-util-remove-position":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/remark-math-extended_6.1.0_1758542163595_0.9244495330813054","host":"s3://npm-registry-packages-npm-production"}},"6.1.1":{"author":{"name":"Jerry Ho","email":"jerrynh770@gmail.com","url":"https://angelrose.org"},"bugs":{"url":"https://github.com/duz52/remark-math-extended/issues"},"contributors":[{"name":"Jerry Ho","email":"jerrynh770@gmail.com","url":"https://angelrose.org"},{"name":"Junyoung Choi","email":"fluke8259@gmail.com","url":"https://rokt33r.github.io"},{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"devDependencies":{"@types/node":"^22.0.0","c8":"^10.0.0","prettier":"^3.0.0","rehype-stringify":"^10.0.0","remark-cli":"^12.0.0","remark-parse":"^11.0.0","remark-preset-wooorm":"^11.0.0","remark-rehype":"^11.0.0","remark-stringify":"^11.0.0","type-coverage":"^2.0.0","typescript":"^5.0.0","unified":"^11.0.0","unist-util-remove-position":"^5.0.0","xo":"^0.60.0"},"dependencies":{"@types/mdast":"^4.0.0","mdast-util-math":"^3.0.0","micromark-extension-math-extended":"^3.2.2","unified":"^11.0.0"},"description":"remark plugin for dollar (`$C_L$`) and TeX-style (`\\(C_L\\)`, `\\[C_L\\]`) math delimiters","exports":"./index.js","funding":"https://buymeacoffee.com/duz52","keywords":["katex","latex","markdown","math","mdast","plugin","remark","remark-plugin","tex","unified"],"license":"MIT","name":"remark-math-extended","repository":{"type":"git","url":"git+https://github.com/duz52/remark-math-extended.git"},"scripts":{"build":"tsc --build --clean && tsc --build && type-coverage","format":"remark --frail --output --quiet -- . && prettier --log-level warn --write -- . && xo --fix","format-check":"remark --frail --quiet -- . && prettier --check --log-level warn -- . && xo","test-api":"npm run test-api-dev && npm run test-api-prod","test-api-dev":"node --conditions development test.js","test-api-prod":"node --conditions production test.js","test-coverage":"c8 --100 --reporter lcov -- npm run test-api","test":"npm run build && npm run format-check && npm run test-coverage"},"sideEffects":false,"type":"module","version":"6.1.1","xo":{"prettier":true,"rules":{"logical-assignment-operators":"off"}},"prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"gitHead":"40c00c1a5de724bc36d8f6d5757bc84d2bd0147e","types":"./index.d.ts","_id":"remark-math-extended@6.1.1","homepage":"https://github.com/duz52/remark-math-extended#readme","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-nFEmFG2+PFtsAmZ2SjnAXslbn/Y0wazWiV8EzXbyF6WD8s7kxoCUvlb8OHmhDBnbMhCApEXNYRirZbGKSQE9Cg==","shasum":"f77e5b1f06b89aa86b352d6cf97aa7144a32bc4a","tarball":"https://registry.npmjs.org/remark-math-extended/-/remark-math-extended-6.1.1.tgz","fileCount":9,"unpackedSize":17967,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/remark-math-extended@6.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD2XzphGoVKl8dGm7N6x/m9Zqas3zBSjS7nHhf0Nk4ligIhALyxy9AtZYodWQStQLCR8CewayNjk1hRtP9HrScHRwlA"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5b3b8c71-ee21-4c5b-963c-fab058a41327"}},"directories":{},"maintainers":[{"name":"nh770","email":"jerryqr368@gmail.com"},{"name":"duz52","email":"jerrynh770@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/remark-math-extended_6.1.1_1785482273038_0.11494587603037187"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-22T11:56:03.594Z","modified":"2026-07-31T07:17:53.453Z","6.1.0":"2025-09-22T11:56:03.777Z","6.1.1":"2026-07-31T07:17:53.174Z"},"bugs":{"url":"https://github.com/duz52/remark-math-extended/issues"},"author":{"name":"Jerry Ho","email":"jerrynh770@gmail.com","url":"https://angelrose.org"},"license":"MIT","homepage":"https://github.com/duz52/remark-math-extended#readme","keywords":["katex","latex","markdown","math","mdast","plugin","remark","remark-plugin","tex","unified"],"repository":{"type":"git","url":"git+https://github.com/duz52/remark-math-extended.git"},"description":"remark plugin for dollar (`$C_L$`) and TeX-style (`\\(C_L\\)`, `\\[C_L\\]`) math delimiters","contributors":[{"name":"Jerry Ho","email":"jerrynh770@gmail.com","url":"https://angelrose.org"},{"name":"Junyoung Choi","email":"fluke8259@gmail.com","url":"https://rokt33r.github.io"},{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"maintainers":[{"name":"nh770","email":"jerryqr368@gmail.com"},{"name":"duz52","email":"jerrynh770@gmail.com"}],"readme":"# remark-math-extended\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\n**[remark][]** plugin to support math with dollar delimiters (`$C_L$`),\nTeX-style inline delimiters (`\\(C_L\\)`), and TeX-style display delimiters\n(`\\[C_L\\]`).\n\n## Contents\n\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(remarkMath[, options])`](#unifieduseremarkmath-options)\n  * [`Options`](#options)\n* [Authoring](#authoring)\n* [HTML](#html)\n* [CSS](#css)\n* [Syntax](#syntax)\n* [Syntax tree](#syntax-tree)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a [unified][] ([remark][]) plugin to add support for math\nsyntax with dollar delimiters (`$…$` and `$$…$$`), TeX-style inline delimiters\n(`\\(…\\)`), and TeX-style display delimiters (`\\[…\\]`).\nYou can use this to add support for parsing and serializing this syntax\nextension.\n\nAs there is no spec for math in markdown, this extension follows how code\n(fenced and text) works in CommonMark, while also supporting TeX-style\ndelimiters alongside dollars (`$`).\n\n## When should I use this?\n\nThis project is useful when you want to support math in markdown.\nExtending markdown with a syntax extension makes the markdown less portable.\nLaTeX equations are also quite hard.\nBut this mechanism works well when you want authors, that have some LaTeX\nexperience, to be able to embed rich diagrams of math in scientific text.\n\nThis extended build is handy when migrating content that already uses\n`\\(…\\)` or `\\[…\\]` alongside `$…$`.\n\nIf you *just* want to turn markdown into HTML (with maybe a few extensions such\nas math), we recommend [`micromark`][micromark] with\n[`micromark-extension-math-extended`][micromark-extension-math-extended]\ninstead.\nIf you don’t use plugins and want to access the syntax tree, you can use\n[`mdast-util-from-markdown`][mdast-util-from-markdown] with\n[`mdast-util-math`][mdast-util-math].\n\nThis plugin adds [fields on nodes][mdast-util-to-hast-fields] so that the\nplugin responsible for turning markdown (mdast) into HTML (hast),\n[`remark-rehype`][remark-rehype], will turn text math (inline) into\n`<code class=\"language-math math-inline\">…</code>` and flow math (block)\ninto `<pre><code class=\"language-math math-display\">…</code></pre>`.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install remark-math-extended\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport remarkMath from 'https://esm.sh/remark-math-extended@6'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n<!--lint disable maximum-line-length no-missing-blank-lines-->\n\n```html\n<script type=\"module\">\n  import remarkMath from 'https://esm.sh/remark-math-extended@6?bundle'\n</script>\n```\n\n<!--lint enable maximum-line-length no-missing-blank-lines-->\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\nLift(\\(C_L\\)) can be determined by Lift Coefficient ($C_L$) like the following\ndisplay equation written with TeX-style brackets.\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-extended'\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<!--lint disable maximum-line-length no-missing-blank-lines-->\n\n```html\n<p>\n  Lift(<code class=\"language-math math-inline\"\n    ><span class=\"katex\">…</span></code\n  >) like the following equation.\n</p>\n<pre><code class=\"language-math math-display\"><span class=\"katex-display\"><span class=\"katex\">…</span></span></code></pre>\n```\n\n<!--lint enable maximum-line-length no-missing-blank-lines-->\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`remarkMath`][api-remark-math].\n\n### `unified().use(remarkMath[, options])`\n\nAdd support for math.\n\n###### Parameters\n\n* `options` ([`Options`][api-options], optional)\n  — configuration\n\n###### Returns\n\nNothing (`undefined`).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n* `backslashDelimiters` (`boolean`, default: `true`)\n  — whether to support TeX-style `\\( ... \\)` inline math and `\\[ ... \\]`\n  display math.\n  These sequences are character escapes in CommonMark, so enabling this option\n  changes their normal Markdown meaning.\n  Set this option to `false` when CommonMark-compatible escapes are preferred.\n* `singleDollarTextMath` (`boolean`, default: `true`)\n  — whether to support text math (inline) with a single dollar.\n  Single dollars work in Pandoc and many other places, but often interfere\n  with “normal” dollars in text.\n  If you turn this off, you can still use two or more dollars for text math.\n\n## Authoring\n\nWhen authoring markdown with math, keep in mind that math doesn’t work in most\nplaces.\nNotably, GitHub currently has a really weird crappy client-side regex-based\nthing.\nBut on your own (math-heavy?) site it can be great!\n\nUse `\\( ... \\)` for inline TeX-style math:\n\n```markdown\nThe lift coefficient is \\(C_L\\).\n```\n\nUse `\\[ ... \\]` for TeX-style display math.\nThe opening delimiter must occur where a block can start.\nThe closing delimiter must be followed only by spaces and a line ending or the\nend of the document.\nThe content and closing delimiter can be on one line:\n\n```markdown\n\\[L = \\frac{1}{2} \\rho v^2 S C_L\\]\n```\n\nThey can also span lines:\n\n```markdown\n\\[\nL = \\frac{1}{2} \\rho v^2 S C_L\n\\]\n```\n\nA matching `\\]` is required.\nWithout one, the opening `\\[` is treated as normal Markdown instead of\nconsuming the remainder of the document.\n\n> 👉 **Compatibility note**: CommonMark normally interprets `\\(` and `\\[`\n> as character escapes.\n> Pass `backslashDelimiters: false` to preserve that behavior.\n\nInstead of a syntax extension to markdown, you can also use fenced code with an\ninfo string of `math`:\n\n````markdown\n```math\nL = \\frac{1}{2} \\rho v^2 S C_L\n```\n````\n\n## HTML\n\nThis plugin integrates with [`remark-rehype`][remark-rehype].\nWhen markdown (mdast) is turned into HTML (hast) the math nodes are turned\ninto `<code class=\"language-math math-inline\">…</code>` and\n`<pre><code class=\"language-math math-display\">…</code></pre>` elements.\nTeX-style parentheses produce inline math and TeX-style brackets produce\ndisplay math.\n\n## CSS\n\nThis package does not relate to CSS.\nYou can choose to render the math with KaTeX, MathJax, or something else, which\nmight need CSS.\n\n## Syntax\n\nSee the syntax docs for [`micromark-extension-math-extended`][mme-syntax].\n\n## Syntax tree\n\nSee the syntax tree docs for [`mdast-util-math`][mdast-util-math-syntax].\n\nThis plugin uses `mdast-util-math` to serialize math nodes.\nIts serializer emits dollar delimiters, so parsing and then serializing\nTeX-style delimiters preserves the math value and display/inline kind but\nchanges `\\( ... \\)` to `$...$` and `\\[ ... \\]` to `$$...$$`.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`][api-options].\n\nIf you’re working with the syntax tree, you can register the new node types\nwith `@types/mdast` by adding a reference:\n\n```js\n/**\n * @import {} from 'mdast-util-math' // Register math nodes.\n * @import {Root} from 'mdast'\n */\n\nimport {visit} from 'unist-util-visit'\n\nfunction myRemarkPlugin() {\n  /**\n   * @param {Root} tree\n   *   Tree.\n   * @returns {undefined}\n   *   Nothing.\n   */\n  return function (tree) {\n    visit(tree, function (node) {\n      console.log(node) // `node` can now be one of the math nodes.\n    })\n  }\n}\n```\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `remark-math-extended@6`,\ncompatible with Node.js 16.\n\nThis plugin works with unified version 6+ and remark version 14+.\nThe previous major (version 4) worked with remark 13.\n\n## Security\n\nUse of `remark-math-extended` does not involve **[rehype][]** ([hast][]) or user\ncontent so there are no openings for [cross-site scripting (XSS)][wiki-xss]\nattacks.\n\n## Related\n\n* [`remark-gfm`](https://github.com/remarkjs/remark-gfm)\n  — support GFM (autolink literals, footnotes, strikethrough, tables,\n  tasklists)\n* [`remark-frontmatter`](https://github.com/remarkjs/remark-frontmatter)\n  — support frontmatter (YAML, TOML, and more)\n* [`remark-directive`](https://github.com/remarkjs/remark-directive)\n  — support directives\n* [`remark-mdx`](https://github.com/mdx-js/mdx/tree/main/packages/remark-mdx)\n  — support MDX (ESM, JSX, expressions)\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][remark-math-author].\n\nExtended modifications © 2025–2026 [Jerry Ho][author].\nSee [license][].\n\n<!-- Definitions -->\n\n<!--lint disable maximum-line-length-->\n\n[api-options]: #options\n\n[api-remark-math]: #unifieduseremarkmath-options\n\n[author]: https://angelrose.org\n\n[build]: https://github.com/duz52/remark-math-extended/actions\n\n[build-badge]: https://github.com/duz52/remark-math-extended/actions/workflows/main.yml/badge.svg\n\n[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md\n\n[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md\n\n[coverage]: https://codecov.io/github/duz52/remark-math-extended\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/duz52/remark-math-extended.svg\n\n[downloads]: https://www.npmjs.com/package/remark-math-extended\n\n[downloads-badge]: https://img.shields.io/npm/dm/remark-math-extended.svg\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[hast]: https://github.com/syntax-tree/hast\n\n[health]: https://github.com/remarkjs/.github\n\n[license]: https://github.com/duz52/remark-math-extended/blob/main/license\n\n[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown\n\n[mdast-util-math]: https://github.com/syntax-tree/mdast-util-math\n\n[mdast-util-math-syntax]: https://github.com/syntax-tree/mdast-util-math#syntax-tree\n\n[mdast-util-to-hast-fields]: https://github.com/syntax-tree/mdast-util-to-hast#fields-on-nodes\n\n[micromark]: https://github.com/micromark/micromark\n\n[micromark-extension-math-extended]: https://github.com/duz52/micromark-extension-math-extended\n\n[mme-syntax]: https://github.com/duz52/micromark-extension-math-extended#syntax\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[remark]: https://github.com/remarkjs/remark\n\n[remark-math-author]: https://rokt33r.github.io\n\n[remark-rehype]: https://github.com/remarkjs/remark-rehype\n\n[size]: https://bundlejs.com/?q=remark-math-extended\n\n[size-badge]: https://img.shields.io/bundlejs/size/remark-math-extended\n\n[support]: https://github.com/remarkjs/.github/blob/main/support.md\n\n[typescript]: https://www.typescriptlang.org\n\n[unified]: https://github.com/unifiedjs/unified\n\n[wiki-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n<!--lint enable maximum-line-length-->\n","readmeFilename":"readme.md"}