LibreChat/client
Danny Avila c0a55aa0f5
🧮 fix: Currency-Safe Single-Dollar LaTeX via Micromark Tokenizer (#15181)
Replaces the preprocessLaTeX string pass, whose currency allowlist missed
suffixes like "$2bn", letting SINGLE_DOLLAR_REGEX rewrite "$2bn to at
least $4bn" into $$-math. Single-dollar math is now a micromark text
construct (client/src/utils/latex.ts) registered by remarkSingleDollarMath,
so each span is decided during parsing with Pandoc-style boundary rules:
non-space after the opener, non-space before and no digit after the
closer, single-line, no backticks, opaque backslash escapes, balanced
braces, and fail-fast on an invalid close so a later price dollar can
never extend a span. Rejected spans stay byte-identical text, and code
spans, fences, and autolinks are structurally protected by the parser.

The LaTeX parsing setting now gates only this plugin; $$, \(...\), and
\[...\] continue to parse unconditionally via remark-math (aliased to
micromark-extension-llm-math, now mirrored in jest moduleNameMapper so
tests exercise the production tokenizer). katex/contrib/mhchem is loaded
with the markdown config, so \ce/\pu render properly instead of being
regex-mangled. splitMarkdown aligns its math options with the renderer.
2026-08-24 22:29:02 -04:00
..
public
scripts
src 🧮 fix: Currency-Safe Single-Dollar LaTeX via Micromark Tokenizer (#15181) 2026-08-24 22:29:02 -04:00
sw
test
babel.config.cjs
check_updates.sh
index.html
jest.config.cjs 🧮 fix: Currency-Safe Single-Dollar LaTeX via Micromark Tokenizer (#15181) 2026-08-24 22:29:02 -04:00
jest.resolver.cjs
nginx.conf
package.json 🧮 fix: Currency-Safe Single-Dollar LaTeX via Micromark Tokenizer (#15181) 2026-08-24 22:29:02 -04:00
postcss.config.cjs
tailwind.config.cjs
tsconfig.json
vite.config.ts