kimi-code/docs
Simon He 7f05f589e7
feat(web): add Mermaid diagram rendering and off-thread KaTeX/Mermaid workers (#1226)
* feat(web): add Mermaid diagram rendering and off-thread KaTeX/Mermaid workers

Enable Mermaid diagram support in the web chat via markstream-vue's enableMermaid(). Set up Web Workers for both KaTeX rendering and Mermaid parsing using markstream-vue's pre-built workers (katexRenderer.worker, mermaidParser.worker), keeping heavy computation off the main thread during live streaming.

* fix(web): skip Mermaid SVG subtrees in file link and markdown link rewriters

processFileLinks() uses a TreeWalker that scans all text nodes in mdRef.
Mermaid diagrams render as inline SVG, and diagram labels containing
file-path-like strings (e.g. src/App.vue) would be replaced with HTML
<button> elements inside SVG <text> nodes, corrupting the rendered diagram.

processMarkdownLinks() similarly queries a[href] inside SVGs; while
isLocalLink() mostly filters these out, explicitly skipping SVG subtrees
is safer.

Add svg to the closest() exclusion in processFileLinks(), and skip
links inside svg in processMarkdownLinks().

* fix(web): satisfy worker import lint

* chore: align mermaid dependency versions

* chore: change mermaid workers changeset to patch

---------

Co-authored-by: qer <wbxl2000@outlook.com>
2026-07-01 02:17:34 +08:00
..
.vitepress feat: custom color themes (#484) 2026-06-09 18:55:15 +08:00
en feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
media Kimi For Coding 2026-05-22 15:54:50 +08:00
public Kimi For Coding 2026-05-22 15:54:50 +08:00
zh feat(agent-core): rework compaction to keep only user prompts and summary (#1214) 2026-07-01 01:17:30 +08:00
.gitignore fix: fix bundle (#956) 2026-06-22 13:59:57 +08:00
AGENTS.md docs: expand AGENTS.md with reader personas, format decisions, and checklist (#507) 2026-06-08 21:46:01 +08:00
index.md Kimi For Coding 2026-05-22 15:54:50 +08:00
package.json feat(web): add Mermaid diagram rendering and off-thread KaTeX/Mermaid workers (#1226) 2026-07-01 02:17:34 +08:00