Skip to content

GROK-20020: Markdown: Support math formulas - #3767

Open
LaykDimon wants to merge 2 commits into
masterfrom
dkovalyov/GROK-20020-math-markdown
Open

GROK-20020: Markdown: Support math formulas#3767
LaykDimon wants to merge 2 commits into
masterfrom
dkovalyov/GROK-20020-math-markdown

Conversation

@LaykDimon

Copy link
Copy Markdown
Contributor

No description provided.

LaykDimon and others added 2 commits April 24, 2026 16:31
Add LaTeX math support to `ui.markdown`. Inline `$...$` and block `$$...$$`
are extracted before the markdown parser runs, rendered via KaTeX when the
FileEditors package is installed, and degrade to `<code class="d4-math-fallback">`
otherwise. Money amounts like `$100 and $200`, code spans `` `$x$` ``, and
fenced code blocks stay literal.

FileEditors plugin exports `renderMath(latex, displayMode)` backed by KaTeX
(added as a direct dep). The plugin is loaded on-demand the first time math
is rendered — no `#autostart`, no cost for plain-markdown callers.

Artifacts:
- js-api/ui.ts: short JSDoc note about math + String.raw.
- FileEditors/src/package.ts: renderMath function, katex imports.
- ApiSamples/scripts/ui/components/markdown-math.js: runnable sample with
  String.raw.
- ApiTests/src/widgets/markdown.ts: 5 tests under new 'Markdown' category
  (plain text, block math, inline math, money not math, code span literal).
- FileEditors stub for the pre-existing package-test.ts import.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant