feat: katex math render for markdown.#131
Open
sqhyz55 wants to merge 5 commits intoxorbitsai:mainfrom
Open
Conversation
7f5d50b to
0684d99
Compare
yiboyasss
reviewed
Mar 13, 2026
Contributor
yiboyasss
left a comment
There was a problem hiding this comment.
Nice improvement!
While testing this locally, I noticed a rendering issue with common shell commands such as: `echo $PATH ` / `echo $HOME`
The `$PATH` / `$HOME` parts are currently interpreted as math expressions and rendered by KaTeX, which breaks the expected display. These patterns are quite common in documentation and code examples.
This happens because the current implementation relies on regex replacement for $...$, which can accidentally match non-math usages of $.
It might be worth considering using a markdown AST-based approach instead, for example integrating math support directly via react-markdown with remark-math and rehype-katex:
import ReactMarkdown from "react-markdown"
import remarkMath from "remark-math"
import rehypeKatex from "rehype-katex"
<ReactMarkdown
remarkPlugins={[remarkMath]}
rehypePlugins={[rehypeKatex]}
>
{markdown}
</ReactMarkdown>0684d99 to
3099fc2
Compare
- Add katex and @types/katex dependencies - Import KaTeX CSS in globals.css - Add renderMathInMarkdown() in markdown-renderer to support inline $...$ and block $$...$$ formulas, skipping code blocks Made-with: Cursor
Move MinimalRequest class definition above the conditional block so it is in scope when filtering tools by category, avoiding potential NameError. Made-with: Cursor
…alization Made-with: Cursor
Switch MarkdownRenderer to an AST-based pipeline using react-markdown, remark-math and rehype-katex to avoid regex-based math parsing issues and correctly handle code blocks and shell snippets like $PATH. Made-with: Cursor
- Skip package-lock.json in codespell (third-party metadata) - Add jsdom and vitest setup for jest-dom matchers and @ alias - Fix MarkdownRenderer test type-check (toBeInTheDocument)
3099fc2 to
3efa74d
Compare
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.