You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Codex app doesn't render latex in markdown viewer #36728
Windows Markdown file preview: root-cause analysis and locally verified fix approach
Reproduced on a newer Windows build. A local proof of concept restores inline and display math without rewriting the Markdown document. The user has also confirmed that LaTeX now renders correctly in the isolated patched desktop app.
Affected surface: the editable Markdown file preview in the right-side panel.
Related reports: #37561 and #23402. These findings concern the math-rendering failure; they do not establish the cause of the separate table-layout symptoms in #37561.
Minimal reproduction
Save the following as a Markdown file and open its rendered file preview in the app:
# Math rendering test
Inline: $x \in \mathbb{R}^n$.
$$\begin{aligned}\dot{x} &= Ax+Bu,\\y &= Cx+Du.\end{aligned}$$| Name | Value || --- | --- || state | $x+y$ |
Inline code must remain literal: `$x+y$`.
```text$$A^\top A=I$$```
The price is $100. Escaped dollar: \$100.
Expected: typeset inline/display math, while code and ordinary prices remain text and the stored document retains its original TeX. Observed before the patch: ordinary Markdown styling works, but formulas in the file preview remain raw source.
Findings from the shipped application modules
There are two relevant rendering paths in this build:
File preview:webview/assets/text-file-editor-tab-content.electron-59e80c303e1d.js, in the Av editor factory reached through Hy → Ey → _y / vy → my → Av. It initializes a CodeMirror 6 / Lezer Markdown parser and Markdown decorations, including Mermaid support, but does not register inline/block math nodes or math-rendering widgets. This accounts for both dollar-delimited inline math and display math remaining text in this surface.
Shared Markdown parsing:webview/assets/app-initial-f87238153a19.js contains the jRn / TRn / SRn math pipeline. Its inline tokenizer and start hint omit single-dollar delimiters. Fixing only that tokenizer is insufficient for the separate file-preview parser.
These are identifiers observed in this particular distributed build, not proposed stable source-level names.
The existing KaTeX modules, styles, and fonts load successfully. Before the patch the fixture produces no math DOM in the file editor; after connecting the parser and widgets it produces 13 rendered formulas with zero KaTeX error nodes. This supports a missing parser/render integration as the cause in this build, rather than missing math fonts.
Fix approach exercised locally
Add single-dollar tokenization to the existing shared math tokenizer and its start hint, respecting escapes, unmatched delimiters, whitespace boundaries, and common currency cases.
Register inline and block math nodes in the file editor's Lezer Markdown extension. Let the existing parser continue to own code spans, fenced/indented code, and surrounding Markdown structure.
Render those nodes with CodeMirror replacement widgets using the already bundled KaTeX, with trust: false. Retain the original text in the document rather than replacing source with HTML or images.
Reveal the original TeX when editing a formula; restore typesetting on blur. Preserve source for incomplete fences and failed asset loading.
This was tested in a separate local runtime copy. The signed Store installation and project Markdown files were not modified. The approach needs to be implemented and reviewed in the maintained desktop source; it is not a proposed binary replacement or an official release.
Validation and limits
5 tokenizer unit checks and 38 renderer/interaction checks passed.
Coverage includes single-dollar math, display math, aligned, bmatrix, cases, an exact sequence, existing backslash delimiters, math in tables/lists/quotes, inline/fenced/indented code, currency, escaped dollars, unmatched fences, and link destinations containing dollars.
The ordinary-Markdown fixture has an identical syntax tree before and after the change. Display operations preserve the document string; double-click/blur and text-edit position mapping were checked.
The complete fixture changes from 0 to 13 rendered formulas; KaTeX fonts load and no formula reports a KaTeX error.
Automated checks mount the actual packaged editor modules in a test container, including a run in the copied desktop runtime. They do not constitute an automated end-to-end test of the signed-in app's file-open/save/reopen workflow.
Subsequent manual feedback confirms LaTeX rendering in the patched app. Full persistence/reopen, large-document performance, and accessibility still need upstream validation.
Sharing this analysis through the existing issue in accordance with the current contribution guidelines. The report was prepared with Codex assistance; the checks above were actually run, and the final rendering confirmation came from the user.
Activity
ShanshuihuaShaojuntao commentedon Sep 7, 2026
Windows Markdown file preview: root-cause analysis and locally verified fix approach
Reproduced on a newer Windows build. A local proof of concept restores inline and display math without rewriting the Markdown document. The user has also confirmed that LaTeX now renders correctly in the isolated patched desktop app.
Environment investigated on 2026-09-07:
26.901.6511.0.26.901.51231, build8109.Related reports: #37561 and #23402. These findings concern the math-rendering failure; they do not establish the cause of the separate table-layout symptoms in #37561.
Minimal reproduction
Save the following as a Markdown file and open its rendered file preview in the app:
Expected: typeset inline/display math, while code and ordinary prices remain text and the stored document retains its original TeX. Observed before the patch: ordinary Markdown styling works, but formulas in the file preview remain raw source.
Findings from the shipped application modules
There are two relevant rendering paths in this build:
webview/assets/text-file-editor-tab-content.electron-59e80c303e1d.js, in theAveditor factory reached throughHy → Ey → _y / vy → my → Av. It initializes a CodeMirror 6 / Lezer Markdown parser and Markdown decorations, including Mermaid support, but does not register inline/block math nodes or math-rendering widgets. This accounts for both dollar-delimited inline math and display math remaining text in this surface.webview/assets/app-initial-f87238153a19.jscontains thejRn / TRn / SRnmath pipeline. Its inline tokenizer and start hint omit single-dollar delimiters. Fixing only that tokenizer is insufficient for the separate file-preview parser.These are identifiers observed in this particular distributed build, not proposed stable source-level names.
The existing KaTeX modules, styles, and fonts load successfully. Before the patch the fixture produces no math DOM in the file editor; after connecting the parser and widgets it produces 13 rendered formulas with zero KaTeX error nodes. This supports a missing parser/render integration as the cause in this build, rather than missing math fonts.
Fix approach exercised locally
trust: false. Retain the original text in the document rather than replacing source with HTML or images.This was tested in a separate local runtime copy. The signed Store installation and project Markdown files were not modified. The approach needs to be implemented and reviewed in the maintained desktop source; it is not a proposed binary replacement or an official release.
Validation and limits
aligned,bmatrix,cases, an exact sequence, existing backslash delimiters, math in tables/lists/quotes, inline/fenced/indented code, currency, escaped dollars, unmatched fences, and link destinations containing dollars.Sharing this analysis through the existing issue in accordance with the current contribution guidelines. The report was prepared with Codex assistance; the checks above were actually run, and the final rendering confirmation came from the user.
thaibalong7 commentedon Nov 6, 2026
As a temporary workaround, open the .md in Chrome with Markdown Plus. It renders inline and block equations with KaTeX.