GROK-20020: Markdown: Support math formulas - #3767
Open
LaykDimon wants to merge 2 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.