Commit 5f9d8f2
feat(chat): render LaTeX/math via lazy KaTeX (#726)
* docs(spec+plan): chat math rendering — correct sequencing (A.0 release prereq)
Verification against the PUBLISHED @cacheplane/partial-markdown (0.3.2) showed
it has NO math support — the math handler lives unreleased in cacheplane source
at 0.4.1. So Part A's premise "ships independently using existing library
support" was false. Corrects the spec to add A.0 (release the already-built
math 0.4.1 to npm) as the one prerequisite, and that the chat dep-bump + math
view must co-ship (md-children renders nothing for an unregistered node type,
so bumping alone would blank out math). Adds the Part A implementation plan.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* docs(plan): KaTeX CSS self-hosted (no CDN) per decision
* feat(chat): lazy KaTeX loader for markdown math rendering
* feat(chat): render LaTeX/math via lazy KaTeX
Math nodes (math-inline/math-display) from @cacheplane/partial-markdown@0.4.x
now render through a MarkdownMathComponent that lazy-loads KaTeX, fixing the
raw "$…$" leak in the chat stream. KaTeX is an optional peer dep (mirrors
marked): zero base-bundle cost; invalid LaTeX or a missing KaTeX falls back to
the raw "$…$" source — never blank, never a crash. CSS is self-hosted by the
consumer (no runtime CDN); example apps import katex.min.css.
- MarkdownMathComponent + katex-loader (lazy import, katexReady signal)
- register math-inline/math-display in cacheplaneMarkdownViews; export the view
- bump partial-markdown ^0.3.0 → ^0.4.1; add optional katex peer
- streaming integration test: $e^{iπ}+1=0$ → KaTeX, not raw $
- README math note; example styles import katex.min.css
NOT YET MERGEABLE: lockfile sync is deferred until @cacheplane/partial-markdown
0.4.1 is published to npm (blocked on npm trusted-publishing setup). Two lint
errors (@nx/dependency-checks: partial-markdown version + katex unused) are
lockfile-state artifacts that clear once `npm install` runs post-publish.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* build(chat): sync lockfile for partial-markdown 0.4.1 + katex
Now that @cacheplane/partial-markdown@0.4.1 is published, sync the lockfile
(adds katex + @types/katex, bumps partial-markdown 0.3.0 → 0.4.1). Clears the
two @nx/dependency-checks lint errors. No platform bindings dropped.
* chore(docs): regenerate api docs
* chore(docs): regenerate api docs
* fix(chat): render raw HTML nodes as escaped text (0.4.x consumption)
Bumping @cacheplane/partial-markdown to 0.4.1 (for math) also pulled in raw
HTML parsing, so `<script>…</script>` and other markup now tokenize as
html-block / html-inline nodes. The markdown view registry had no renderer
for them, so they rendered as nothing — dropping the literal text and breaking
the markdown-surfaces e2e XSS-safety assertion.
Add MarkdownHtmlComponent rendering node.raw as ESCAPED text (Angular
interpolation), registered for html-block + html-inline. Restores the pre-0.4
behavior (HTML shown as literal text, never executed) and keeps the chat
XSS-safe. Updates the registry-count test (24 → 26) and exports the component.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore(docs): regenerate api docs
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>1 parent a8ee48f commit 5f9d8f2
20 files changed
Lines changed: 1132 additions & 18 deletions
File tree
- apps/website/content/docs/chat/api
- docs/superpowers
- plans
- specs
- examples
- ag-ui/angular
- chat/angular
- libs/chat
- src
- lib
- markdown
- views
- streaming
- styles
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5001 | 5001 | | |
5002 | 5002 | | |
5003 | 5003 | | |
| 5004 | + | |
| 5005 | + | |
| 5006 | + | |
| 5007 | + | |
| 5008 | + | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
| 5016 | + | |
| 5017 | + | |
| 5018 | + | |
| 5019 | + | |
| 5020 | + | |
| 5021 | + | |
| 5022 | + | |
| 5023 | + | |
| 5024 | + | |
| 5025 | + | |
5004 | 5026 | | |
5005 | 5027 | | |
5006 | 5028 | | |
| |||
5087 | 5109 | | |
5088 | 5110 | | |
5089 | 5111 | | |
| 5112 | + | |
| 5113 | + | |
| 5114 | + | |
| 5115 | + | |
| 5116 | + | |
| 5117 | + | |
| 5118 | + | |
| 5119 | + | |
| 5120 | + | |
| 5121 | + | |
| 5122 | + | |
| 5123 | + | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
| 5128 | + | |
| 5129 | + | |
| 5130 | + | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
5090 | 5146 | | |
5091 | 5147 | | |
5092 | 5148 | | |
| |||
0 commit comments