Skip to content

fix: add rehype-raw plugin to render raw HTML tables in markdown content - #75

Closed
fallleave001 wants to merge 2 commits into
agegr:mainfrom
fallleave001:fix/html-table-rendering
Closed

fallleave001 wants to merge 2 commits into
agegr:mainfrom
fallleave001:fix/html-table-rendering

Conversation

@fallleave001

Copy link
Copy Markdown
Contributor

Problem

Markdown content containing raw HTML <table> elements is not rendered
as tables in two places:

  1. Chat messages (MarkdownBody.tsx): HTML tags are silently stripped
    by react-markdown because rehype-raw is not included.
  2. File preview (FileViewer.tsx): Same issue in the markdown file
    preview (Preview mode).

Fix

Add rehype-raw to the rehypePlugins array in both components:

  • components/MarkdownBody.tsx — used for chat message rendering
  • components/FileViewer.tsx — used for markdown file preview

Both already had remarkGfm / rehype-katex but were missing
rehype-raw for raw HTML passthrough.

Testing

Confirmed that HTML <table> in .md files renders correctly in both
chat messages and file preview mode.

cnbattle added a commit to cnbattle/pi-web that referenced this pull request Jun 23, 2026
…upstream

PR agegr#83: fix extension/package tools available in pi-web new sessions
PR agegr#80: load extension models in web model selector
PR agegr#78: add ToolsConfig panel with individual tool toggles
PR agegr#65: add scroll-to-bottom control for chat sessions
PR agegr#75: add rehype-raw plugin to render HTML tables in markdown
PR agegr#76: fix stack overflow on large session files (+TTL cache)
@agegr

agegr commented Jun 23, 2026

Copy link
Copy Markdown
Owner

已由 e974bc6 解决,并补了 rehype-sanitize 和依赖声明,所以不合并原 PR。

@agegr agegr closed this Jun 23, 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.

3 participants