{"_id":"micromark-extension-math-extended","_rev":"4-aa9ee322f23a90e70ed14f887944179c","name":"micromark-extension-math-extended","dist-tags":{"latest":"3.2.2"},"versions":{"3.2.0":{"name":"micromark-extension-math-extended","version":"3.2.0","keywords":["micromark","micromark-extension","micromark-extension-math","micromark-extension-math-extended","math","katex","latex","tex","markdown","unified"],"author":{"url":"https://angelrose.org","name":"Jerry Ho","email":"jerrynh770@gmail.com"},"license":"MIT","_id":"micromark-extension-math-extended@3.2.0","maintainers":[{"name":"nh770","email":"jerrynh770@gmail.com"}],"contributors":[{"url":"https://angelrose.org","name":"Jerry Ho","email":"jerrynh770@gmail.com"},{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"homepage":"https://github.com/Jerrynh770/micromark-extension-math-extended#readme","bugs":{"url":"https://github.com/Jerrynh770/micromark-extension-math-extended/issues"},"xo":{"rules":{"unicorn/prefer-at":"off","unicorn/no-this-assignment":"off","logical-assignment-operators":"off"},"prettier":true,"overrides":[{"files":["**/*.d.ts"],"rules":{"@typescript-eslint/ban-types":["error",{"extendDefaults":true}],"@typescript-eslint/array-type":["error",{"default":"generic"}],"@typescript-eslint/consistent-type-definitions":["error","interface"]}}]},"dist":{"shasum":"83a06c1327fc5cd89e609015db4e0a4fd586b44b","tarball":"https://registry.npmjs.org/micromark-extension-math-extended/-/micromark-extension-math-extended-3.2.0.tgz","fileCount":23,"integrity":"sha512-meHvJQb75wF0ttgLJNEEVk3thYDiQxXOU02fd11xEkwZI+0dc8nXQ0uArEyU9vwX5l/+JKxPDEWA02BMPOYUQQ==","signatures":[{"sig":"MEQCIGMY+8iVUdOvvd0RzyVeKrC1egx1b2NzeHppK1w4xkHzAiANby59475X218lTnhok11S1AnjO6rpZBlsvIRswu80dg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67223},"type":"module","types":"./index.d.ts","exports":{"default":"./index.js","development":"./dev/index.js"},"gitHead":"6c416a9b76cff928e699b9db326dfd465797bfd7","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage && micromark-build","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","prepack":"npm run build && npm run format","test-api":"npm run test-api-dev && npm run test-api-prod","test-api-dev":"node --conditions development test/index.js","test-api-prod":"node --conditions production test/index.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/micromark-extension-math-extended.git","type":"git"},"_npmVersion":"11.1.0","description":"micromark extension to support math (`$C_L$`) and (`\\[C_L\\]`)","directories":{},"sideEffects":false,"_nodeVersion":"20.18.1","dependencies":{"katex":"^0.16.0","devlop":"^1.0.0","@types/katex":"^0.16.0","micromark-util-types":"^2.0.0","micromark-util-symbol":"^2.0.0","micromark-factory-space":"^2.0.0","micromark-util-character":"^2.0.0"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"detail":true,"strict":true,"atLeast":100,"ignoreCatch":true},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","xo":"^0.59.0","prettier":"^3.0.0","micromark":"^4.0.0","remark-cli":"^12.0.0","typescript":"^5.0.0","@types/node":"^22.0.0","type-coverage":"^2.0.0","micromark-build":"^2.0.0","remark-preset-wooorm":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/micromark-extension-math-extended_3.2.0_1758380469004_0.027517279383644455","host":"s3://npm-registry-packages-npm-production"}},"3.2.1":{"name":"micromark-extension-math-extended","version":"3.2.1","keywords":["micromark","micromark-extension","micromark-extension-math","micromark-extension-math-extended","math","katex","latex","tex","markdown","unified"],"author":{"url":"https://angelrose.org","name":"Jerry Ho","email":"jerrynh770@gmail.com"},"license":"MIT","_id":"micromark-extension-math-extended@3.2.1","maintainers":[{"name":"nh770","email":"jerrynh770@gmail.com"}],"contributors":[{"url":"https://angelrose.org","name":"Jerry Ho","email":"jerrynh770@gmail.com"},{"url":"https://wooorm.com","name":"Titus Wormer","email":"tituswormer@gmail.com"}],"homepage":"https://github.com/Jerrynh770/micromark-extension-math-extended#readme","bugs":{"url":"https://github.com/Jerrynh770/micromark-extension-math-extended/issues"},"xo":{"rules":{"unicorn/prefer-at":"off","unicorn/no-this-assignment":"off","logical-assignment-operators":"off"},"prettier":true,"overrides":[{"files":["**/*.d.ts"],"rules":{"@typescript-eslint/ban-types":["error",{"extendDefaults":true}],"@typescript-eslint/array-type":["error",{"default":"generic"}],"@typescript-eslint/consistent-type-definitions":["error","interface"]}}]},"dist":{"shasum":"cc84c8d498ce4e4bd1b4c5d467c8255c336a3807","tarball":"https://registry.npmjs.org/micromark-extension-math-extended/-/micromark-extension-math-extended-3.2.1.tgz","fileCount":23,"integrity":"sha512-0yo/ejZy/RW5jriDEMIqO9DNj01yDe6kEe67Lwv5cgU/Qm90kT7fentU6t7J2Vwqk/tYpoN8TksJPOX+Oly12w==","signatures":[{"sig":"MEUCIQDohDQTqfrimWAkJVqhDhaDH/EK67KKOV7JuaR0Rp2fCgIgeumTairUPp7c5EptppnWFPze6g5DFL9ZJktVaTzT0B8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68619},"type":"module","types":"./index.d.ts","exports":{"default":"./index.js","development":"./dev/index.js"},"gitHead":"ec6ec49ace22d7b3e2d74088e0f3fc38ed398206","scripts":{"test":"npm run build && npm run format && npm run test-coverage","build":"tsc --build --clean && tsc --build && type-coverage && micromark-build","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","prepack":"npm run build && npm run format","test-api":"npm run test-api-dev && npm run test-api-prod","test-api-dev":"node --conditions development test/index.js","test-api-prod":"node --conditions production test/index.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/micromark-extension-math-extended.git","type":"git"},"_npmVersion":"11.1.0","description":"micromark extension to support math (`$C_L$`) and (`\\[C_L\\]`)","directories":{},"sideEffects":false,"_nodeVersion":"20.18.1","dependencies":{"katex":"^0.16.0","devlop":"^1.0.0","@types/katex":"^0.16.0","micromark-util-types":"^2.0.0","micromark-util-symbol":"^2.0.0","micromark-factory-space":"^2.0.0","micromark-util-character":"^2.0.0"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"detail":true,"strict":true,"atLeast":100,"ignoreCatch":true},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","xo":"^0.59.0","prettier":"^3.0.0","micromark":"^4.0.0","remark-cli":"^12.0.0","typescript":"^5.0.0","@types/node":"^22.0.0","type-coverage":"^2.0.0","micromark-build":"^2.0.0","remark-preset-wooorm":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/micromark-extension-math-extended_3.2.1_1758445489013_0.7812373044015961","host":"s3://npm-registry-packages-npm-production"}},"3.2.2":{"name":"micromark-extension-math-extended","version":"3.2.2","description":"micromark extension for dollar (`$C_L$`) and TeX-style (`\\(C_L\\)`, `\\[C_L\\]`) math delimiters","license":"MIT","keywords":["micromark","micromark-extension","micromark-extension-math","micromark-extension-math-extended","math","katex","latex","tex","markdown","unified"],"repository":{"type":"git","url":"git+https://github.com/duz52/micromark-extension-math-extended.git"},"bugs":{"url":"https://github.com/duz52/micromark-extension-math-extended/issues"},"funding":"https://buymeacoffee.com/duz52","author":{"name":"Jerry Ho","email":"jerrynh770@gmail.com","url":"https://angelrose.org"},"contributors":[{"name":"Jerry Ho","email":"jerrynh770@gmail.com","url":"https://angelrose.org"},{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","exports":{"development":"./dev/index.js","default":"./index.js"},"dependencies":{"@types/katex":"^0.16.0","devlop":"^1.0.0","katex":"^0.16.0","micromark-factory-space":"^2.0.0","micromark-util-character":"^2.0.0","micromark-util-symbol":"^2.0.0","micromark-util-types":"^2.0.0"},"devDependencies":{"@types/node":"^22.0.0","c8":"^10.0.0","micromark":"^4.0.0","micromark-build":"^2.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","remark-preset-wooorm":"^10.0.0","type-coverage":"^2.0.0","typescript":"^5.0.0","xo":"^0.59.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage && micromark-build","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","format-check":"remark . -qf && prettier . -c --log-level warn && xo","test-api-prod":"node --conditions production test/index.js","test-api-dev":"node --conditions development test/index.js","test-api":"npm run test-api-dev && npm run test-api-prod","test-coverage":"c8 --100 --reporter lcov npm run test-api","test":"npm run build && npm run format-check && npm run test-coverage"},"prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"ignoreCatch":true,"strict":true},"xo":{"overrides":[{"files":["**/*.d.ts"],"rules":{"@typescript-eslint/array-type":["error",{"default":"generic"}],"@typescript-eslint/ban-types":["error",{"extendDefaults":true}],"@typescript-eslint/consistent-type-definitions":["error","interface"]}}],"prettier":true,"rules":{"logical-assignment-operators":"off","unicorn/no-this-assignment":"off","unicorn/prefer-at":"off"}},"gitHead":"3c08635b02b68be0eea51eb1fcfde1b9ec3514ee","types":"./index.d.ts","_id":"micromark-extension-math-extended@3.2.2","homepage":"https://github.com/duz52/micromark-extension-math-extended#readme","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-u0Mhvjz2c++9Gd6/rYIYEBrEvZeNa7hIH3roqis+sA9AuP4hKzvuMENMOF0shs44LJkqJv33rXRCCqLzhlBCsQ==","shasum":"18d21fea2503b279c0f8baf2375c06379cebf2e4","tarball":"https://registry.npmjs.org/micromark-extension-math-extended/-/micromark-extension-math-extended-3.2.2.tgz","fileCount":23,"unpackedSize":73658,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/micromark-extension-math-extended@3.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDTINbFfTzwCzEEGuL8CdDAKB2W7e4nYmfKaOtd8aRzGgIhAPyYatNMDVGMkSjiOM8QKXiB4bPGELCUeXJOmPeIvW3I"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3d1f1134-fd18-4ea0-bccf-6649caa5fc66"}},"directories":{},"maintainers":[{"name":"nh770","email":"jerryqr368@gmail.com"},{"name":"duz52","email":"jerrynh770@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/micromark-extension-math-extended_3.2.2_1785338332837_0.915230965231588"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-20T15:01:09.004Z","modified":"2026-07-29T15:18:53.336Z","3.2.0":"2025-09-20T15:01:09.200Z","3.2.1":"2025-09-21T09:04:49.203Z","3.2.2":"2026-07-29T15:18:52.973Z"},"bugs":{"url":"https://github.com/duz52/micromark-extension-math-extended/issues"},"author":{"name":"Jerry Ho","email":"jerrynh770@gmail.com","url":"https://angelrose.org"},"license":"MIT","homepage":"https://github.com/duz52/micromark-extension-math-extended#readme","keywords":["micromark","micromark-extension","micromark-extension-math","micromark-extension-math-extended","math","katex","latex","tex","markdown","unified"],"repository":{"type":"git","url":"git+https://github.com/duz52/micromark-extension-math-extended.git"},"description":"micromark extension 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":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"maintainers":[{"name":"nh770","email":"jerryqr368@gmail.com"},{"name":"duz52","email":"jerrynh770@gmail.com"}],"readme":"# micromark-extension-math-extended\n\n## Extended mathematical notation support for micromark\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\n[micromark][] extensions to support math with dollar delimiters (`$C_L$`),\nTeX-style inline delimiters (`\\(C_L\\)`), and TeX-style display delimiters\n(`\\[C_L\\]`).\n\n## Notice\n\nThis package is an **extended version** of the MIT-licensed\n`micromark-extension-math`.\nIt adds LaTeX-style bracket notation support based on:\n\n* Functional specification derived from behavioral observation\n* Standard LaTeX mathematical notation practices\n* Existing micromark extension patterns and APIs\n\n**Original work**: `micromark-extension-math` (c) Titus Wormer\n(MIT License)\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When to use this](#when-to-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`math(options?)`](#mathoptions)\n  * [`mathHtml(options?)`](#mathhtmloptions)\n  * [`HtmlOptions`](#htmloptions)\n  * [`Options`](#options)\n* [Authoring](#authoring)\n* [HTML](#html)\n* [CSS](#css)\n* [Syntax](#syntax)\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 contains two extensions that add support for math syntax\nin markdown to [`micromark`][micromark].\n\nAs there is no spec for math in Markdown, dollar-delimited math follows how\ncode (fenced and text) works in CommonMark.\nBackslash-delimited math follows TeX’s paired `\\( ... \\)` and `\\[ ... \\]`\nsemantics.\n\n## When to 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\nYou can use these extensions when you are working with [`micromark`][micromark]\nalready.\n\nWhen you need a syntax tree, you can combine this package with\n[`mdast-util-math`][mdast-util-math].\n\nAll these packages are used [`remark-math`][remark-math], which focusses on\nmaking it easier to transform content by abstracting these internals away.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n[npm][]:\n\n```sh\nnpm install micromark-extension-math-extended\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {math, mathHtml} from 'https://esm.sh/micromark-extension-math-extended@3'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {math, mathHtml} from 'https://esm.sh/micromark-extension-math-extended@3?bundle'\n</script>\n```\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\nLift($L$) can be determined by Lift Coefficient ($C_L$) like the following equation.\n\n$$\nL = \\frac{1}{2} \\rho v^2 S C_L\n$$\n```\n\n...and our module `example.js` looks as follows:\n\n```js\nimport fs from 'node:fs/promises'\nimport {micromark} from 'micromark'\nimport {math, mathHtml} from 'micromark-extension-math-extended'\n\nconst output = micromark(await fs.readFile('example.md'), {\n  extensions: [math()],\n  htmlExtensions: [mathHtml()]\n})\n\nconsole.log(output)\n```\n\n...now running `node example.js` yields (abbreviated):\n\n```html\n<p>Lift(<span class=\"math math-inline\"><span class=\"katex\">...</span></span>)\ncan be determined by Lift Coefficient\n(<span class=\"math math-inline\"><span class=\"katex\">...</span></span>)\nlike the following equation.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\">...</span></span></div>\n```\n\n## API\n\nThis package exports the identifiers [`math`][api-math] and\n[`mathHtml`][api-math-html].\nThere is no default export.\n\nThe export map supports the [`development` condition][development].\nRun `node --conditions development module.js` to get instrumented dev code.\nWithout this condition, production code is loaded.\n\n### `math(options?)`\n\nCreate an extension for `micromark` to enable math syntax.\n\n###### Parameters\n\n* `options` ([`Options`][api-options], default: `{}`)\n  — configuration\n\n###### Returns\n\nExtension for `micromark` that can be passed in `extensions`, to enable math\nsyntax ([`Extension`][micromark-extension]).\n\n### `mathHtml(options?)`\n\nCreate an extension for `micromark` to support math when serializing to HTML.\n\n> 👉 **Note**: this uses KaTeX to render math.\n\n###### Parameters\n\n* `options` ([`HtmlOptions`][api-html-options], default: `{}`)\n  — configuration\n\n###### Returns\n\nExtension for `micromark` that can be passed in `htmlExtensions`, to support\nmath when serializing to HTML ([`HtmlExtension`][micromark-html-extension]).\n\n### `HtmlOptions`\n\nConfiguration for HTML output (optional).\n\n> 👉 **Note**: passed to [`katex.renderToString`][katex-options].\n> `displayMode` is overwritten by this plugin, to `false` for math in text\n> (inline), and `true` for math in flow (block).\n\n###### Type\n\n```ts\ntype Options = Omit<import('katex').KatexOptions, 'displayMode'>\n```\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 math (text, 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 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!\nYou can use code (fenced) with an info string of `math` to improve this, as\nthat works in many places.\n\nUse `\\( ... \\)` for inline backslash-delimited math:\n\n```markdown\nThe result is \\(a + b\\).\n```\n\nUse `\\[ ... \\]` for display math.\nThe opening delimiter must occur where a flow construct can start, and the\nclosing delimiter must be followed only by spaces and a line ending or the end\nof the document.\nThe content and closing delimiter can be on the opening line:\n\n```markdown\n\\[a + b\\]\n```\n\nThey can also span lines:\n\n```markdown\n\\[\na + b\\]\n```\n\nOr all delimiters can occur on separate lines:\n\n```markdown\n\\[\na + b\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\n## HTML\n\nMath (flow) does not relate to HTML elements.\n`MathML`, which is sort of like SVG but for math, exists but it doesn’t work\nwell and isn’t widely supported.\nInstead, this uses [KaTeX][], which generates MathML as a fallback but also\ngenerates a bunch of divs and spans so math look pretty.\nThe KaTeX result is wrapped in `<div>` (for flow, block) and `<span>` (for text,\ninline) elements, with two classes: `math` and either `math-display` or\n`math-inline`.\nBackslash parentheses produce inline math and backslash brackets produce\ndisplay math.\n\nWhen turning markdown into HTML, each line ending in math (text) is turned\ninto a space.\n\n## CSS\n\nThe HTML produced by KaTeX requires CSS to render correctly.\nYou should use `katex.css` somewhere on the page where the math is shown to\nstyle it properly.\nAt the time of writing, the last version is:\n\n<!-- To do: update and copy paste the one from: https://katex.org/docs/browser -->\n\n```html\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css\">\n```\n\n## Syntax\n\nMath forms with the following simplified BNF:\n\n```abnf\nmathText ::= mathTextDollar / mathTextBackslash\nmathTextDollar ::= sequenceDollarText 1*byte sequenceDollarText\nmathTextBackslash ::= \"\\\\(\" *byte \"\\\\)\"\n\nmathFlow ::= mathFlowDollar / mathFlowBackslash\nmathFlowDollar ::= fenceDollarOpen *( eol *line ) [ eol fenceDollarClose ]\nmathFlowBackslash ::= \"\\\\[\" *byte \"\\\\]\" *spaceOrTab ( eol / eof )\n; Restriction: an unescaped nested \"\\\\[\" cannot occur in\n; `mathFlowBackslash` content.  Paired backslashes remain content, so the\n; common TeX line-break form \"\\\\\\\\[2pt]\" is allowed.\n\nfenceDollarOpen ::= sequenceDollarFlow *spaceOrTab [meta]\nfenceDollarClose ::= sequenceDollarFlow *spaceOrTab\nsequenceDollarText ::= 1*\"$\"\nsequenceDollarFlow ::= 2*\"$\"\nmeta ::= 1*line\n\n; Character groups for informational purposes.\nbyte ::= %x00-FFFF\neol ::= \"\\n\" | \"\\r\" | \"\\r\\n\"\neof ::= end of file\nline ::= byte - eol\n```\n\nFor dollar-delimited math, the opening and closing sequences must contain the\nsame number of markers.\nA dollar cannot occur in flow meta.\nDollar flow meta is optional and ignored when rendering.\n\nDollar sequences are greedy: they cannot be preceded or followed by more dollar\nmarkers.\nYou can include dollar delimiters inside math text by stacking more markers or\nmixing delimiter styles:\n\n```markdown\nMix styles: \\( $a$ \\) or include more markers: $a$$b$.\n```\n\nIt is also possible to include one dollar marker by padding with a longer\nfence:\n\n```markdown\nInclude just one: $$ $ $$.\n```\n\nTo illustrate dollar greediness:\n\n```markdown\nNot math: $$x$.\n\nNot math: $x$$.\n\nEscapes work, this is math: \\$$x$.\n\nEscapes work, this is math: $x$\\$.\n```\n\nYields:\n\n```html\n<p>Not math: $$x$.</p>\n<p>Not math: $x$$.</p>\n<p>Escapes work, this is math: $<span>...</span>.</p>\n<p>Escapes work, this is math: <span>...</span>$.</p>\n```\n\nWhen turning math text into HTML, the first and last space are removed if both\nexist and there is also a non-space in the math.\nLine endings are considered spaces at that stage.\n\nThe above grammar does not show how indentation of each line is handled.\nTo parse dollar math flow, let `x` be the number of `space_or_tab` characters\nbefore the opening fence sequence, after interpreting tabs based on how many\nvirtual spaces they represent.\nEach line of text is then allowed (not required) to be indented with up\nto `x` spaces or tabs, which are then ignored as an indent instead of being\nconsidered as part of the content.\nThis indent does not affect the closing fence.\nIt can be indented up to a separate 3 real or virtual spaces.\nA bigger indent makes it part of the content instead of a fence.\n\nDollar flow `meta` is interpreted as the\n[string][micromark-content-types] content type.\nThat means that character escapes and character references are allowed.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types [`HtmlOptions`][api-html-options]\nand [`Options`][api-options].\n\n## Compatibility\n\nThe current release line supports Node.js 16 and later.\n\nThis package works with `micromark` version `3` and later.\n\nThis package extends `micromark-extension-math` with backslash delimiters.\nWhen `backslashDelimiters` is enabled, it intentionally changes the CommonMark\nmeaning of `\\(` and `\\[`.\n`mdast-util-math` and `remark-math` can consume the resulting math tokens, but\ntheir Markdown serializer emits dollar delimiters.\nRound trips therefore preserve the math value and display/inline kind, but not\nthe original delimiter style.\n\n## Security\n\nThis package is safe assuming that you trust KaTeX.\nAny vulnerability in it could open you to a [cross-site scripting (XSS)][xss]\nattack.\n\n## Related\n\n* [`remark-math`][remark-math]\n  — remark (and rehype) plugins to support math\n* [`mdast-util-math`][mdast-util-math]\n  — mdast utility to support math\n\n## Contribute\n\nSee [`contributing.md` in `micromark/.github`][contributing] for ways to get\nstarted.\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\nMIT © 2020 [Titus Wormer][author].\n\nExtended modifications © 2025–2026 [Jerry Ho][fork-author].\nSee [license][].\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/duz52/micromark-extension-math-extended/actions/workflows/main.yml/badge.svg\n\n[build]: https://github.com/duz52/micromark-extension-math-extended/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/duz52/micromark-extension-math-extended.svg\n\n[coverage]: https://codecov.io/github/duz52/micromark-extension-math-extended\n\n[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-math-extended.svg\n\n[downloads]: https://www.npmjs.com/package/micromark-extension-math-extended\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-math-extended\n\n[size]: https://bundlejs.com/?q=micromark-extension-math-extended\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esmsh]: https://esm.sh\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[fork-author]: https://angelrose.org\n\n[contributing]: https://github.com/micromark/.github/blob/main/contributing.md\n\n[support]: https://github.com/micromark/.github/blob/main/support.md\n\n[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[typescript]: https://www.typescriptlang.org\n\n[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions\n\n[micromark]: https://github.com/micromark/micromark\n\n[micromark-content-types]: https://github.com/micromark/micromark#content-types\n\n[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension\n\n[micromark-extension]: https://github.com/micromark/micromark#syntaxextension\n\n[mdast-util-math]: https://github.com/syntax-tree/mdast-util-math\n\n[remark-math]: https://github.com/remarkjs/remark-math\n\n[katex]: https://katex.org\n\n[katex-options]: https://katex.org/docs/options.html\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[api-math]: #mathoptions\n\n[api-math-html]: #mathhtmloptions\n\n[api-options]: #options\n\n[api-html-options]: #htmloptions\n","readmeFilename":"readme.md"}