fix(web): replace default markdown renderer and expand syntax support (#5689)

* fix(markdown): render default markdown with marked

- switch default frontend markdown rendering from react-markdown/remark-gfm to marked to avoid old WebKit parse failures from lookbehind regex literals
- sanitize marked HTML output with DOMPurify and preserve external link target and rel behavior
- remove default direct dependencies on react-markdown, remark-gfm, and rehype-raw while leaving classic unchanged

* fix(markdown): expand default markdown rendering support

- render default markdown with marked extensions for KaTeX formulas, page breaks, and common emoji shortcodes.
- sanitize KaTeX output with an explicit DOMPurify allowlist while preserving external link behavior.
- avoid overriding marked text rendering so lists and inline parsing keep their internal parser context.

* fix(markdown): render diagram code blocks in default UI

- add sanitized SVG rendering for flow and sequence diagram code blocks.
- size flow nodes from their labels and route edges from node anchors to prevent clipping.
- style diagram nodes, arrows, labels, and notes with theme-aware classes.
This commit is contained in:
QuentinHsu
2026-06-24 19:44:34 +08:00
committed by GitHub
parent 2cbdfa0398
commit f4473d963c
3 changed files with 730 additions and 28 deletions
+3 -3
View File
@@ -41,10 +41,13 @@
"cmdk": "^1.1.1",
"date-fns": "^4.3.0",
"dayjs": "catalog:",
"dompurify": "3.4.5",
"i18next": "^26.2.0",
"i18next-browser-languagedetector": "^8.2.1",
"input-otp": "^1.4.2",
"katex": "^0.17.0",
"lucide-react": "^1.16.0",
"marked": "^18.0.5",
"motion": "^12.40.0",
"nanoid": "^5.1.11",
"next-themes": "^0.4.6",
@@ -55,12 +58,9 @@
"react-hook-form": "^7.76.1",
"react-i18next": "^17.0.8",
"react-icons": "catalog:",
"react-markdown": "catalog:",
"react-resizable-panels": "^4.11.2",
"react-top-loading-bar": "^3.0.2",
"recharts": "3.8.1",
"rehype-raw": "^7.0.0",
"remark-gfm": "catalog:",
"shiki": "^4.1.0",
"sonner": "^2.0.7",
"sse.js": "catalog:",