Skip to content

Codex app doesn't render latex in markdown viewer #36728

Open

Description

@danpetruk

What version of the Codex App are you using (From “About Codex” dialog)?

Version 26.727.51351

What subscription do you have?

pro

What platform is your computer?

Windows 11

What issue are you seeing?

Image

What steps can reproduce the bug?

Ask Codex to create .md with latex and open it within Codex App

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    app
    on Aug 3, 2026
  2. added
    bug
    windows-os
    on Aug 3, 2026
  3. ShanshuihuaShaojuntao commented on Sep 7, 2026

    @ShanshuihuaShaojuntao

    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:

    • Windows x64 package: 26.901.6511.0.
    • Application product version: 26.901.51231, build 8109.
    • 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:

    1. 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.
    2. 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.

  4. thaibalong7 commented on Nov 6, 2026

    @thaibalong7

    As a temporary workaround, open the .md in Chrome with Markdown Plus. It renders inline and block equations with KaTeX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions