Skip to content

feat(markdown): support LaTeX bracket delimiters - #239

Closed
GuangmingChan wants to merge 1 commit into
agegr:mainfrom
GuangmingChan:feat/latex-delimiter-support
Closed

feat(markdown): support LaTeX bracket delimiters#239
GuangmingChan wants to merge 1 commit into
agegr:mainfrom
GuangmingChan:feat/latex-delimiter-support

Conversation

@GuangmingChan

Copy link
Copy Markdown

Problem

Pi Web already renders KaTeX for $...$ and $$...$$, but model
responses commonly use \(...\) and \[...\]. These delimiters were
displayed as plain text.

Changes

  • Normalize \(...\) to inline math syntax.
  • Normalize \[...\] to display math syntax.
  • Preserve delimiters inside inline and fenced code blocks.
  • Add rendering and regression tests.

Validation

  • node --test components/MarkdownBody.test.mjs
  • npx tsc --noEmit
  • npm run build

简言之,我修改了数学公式渲染功能,请审核。如果修改合适,请把它合并到官方版本。

@agegr

agegr commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Support has now been implemented on main in commit 65d59dc using the shared Markdown normalizer for both chat and file preview. The implementation only converts complete delimiter pairs and preserves code, escaped literals, raw HTML, and link destinations.
Thanks again for the contribution.

@agegr agegr closed this Jul 25, 2026
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.

2 participants