Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat(web): add LaTeX math support and unify streamdown actions styling (#292)

Genera45ce23d2d22
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c41f14cfa..be588513c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -241,6 +241,9 @@ importers:
'@streamdown/cjk':
specifier: ^1.0.3
+ '@streamdown/math':
+ specifier: ^1.0.2
+ version: 1.0.2([email protected])
'@streamdown/mermaid':
specifier: ^1.0.2
version: 1.0.2([email protected])
@@ -298,6 +301,9 @@ importers:
input-otp:
specifier: ^1.4.2
+ katex:
+ specifier: ^0.17.0
+ version: 0.17.0
lucide-react:
specifier: ^1.16.0
version: 1.16.0([email protected])
@@ -2689,6 +2695,11 @@ packages:
peerDependencies:
react: ^18.0.0 || ^19.0.0
+ '@streamdown/[email protected]':
+ resolution: {integrity: sha512-r8Ur9/lBuFnzZAFdEWrLUF2s/gRwRRRwruqltdZibyjbCBnuW7SJbFm26nXqvpJPW/gzpBUMrBVBzd88z05D5g==}
+ peerDependencies:
+ react: ^18.0.0 || ^19.0.0
+
'@streamdown/[email protected]':
resolution: {integrity: sha512-Fr/4sBWnAeSnxM3PcrV/+DiZe5oPMq9gOkUIAH7ZauJeuwrZ/DVzD4g0zlav6AH0axh2m/sOfrfLtY5aLT7niw==}
peerDependencies:
@@ -3240,6 +3251,9 @@ packages:
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-trgaNyfU+Xh2Tc+ABIb44a5AYUpicB3uwirOioeOkNPPbmgRNtcWyDeeFRzjPZENO9Vq8gvVqfhaaXWLlevVwg==}
+
resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
@@ -5276,6 +5290,12 @@ packages:
resolution: {integrity: sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-N+LqofjR2zuzTjCPzyDUdSshy4Ma6li7p/c3pA78uTwzFgENbgbUrm2ugwsOdcjI1muO+o6Dgzp9p8WHtn/39Q==}
+
+ resolution: {integrity: sha512-zJfpXq44yff2hmE0XmwEOzdWin5xwH+QIhMLOScpX91e/NSGPsAzNCvLQDIEPyO2TXi+lBmU6hjLIhV8MwP2kw==}
+
resolution: {integrity: sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==}
@@ -5312,6 +5332,9 @@ packages:
resolution: {integrity: sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A==}
+ resolution: {integrity: sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==}
+
resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}
@@ -5758,6 +5781,10 @@ packages:
resolution: {integrity: sha512-pQpZbdBu7wCTmQUh7ufPmLr0pFoObnGUoL/yhtwJDgmmQpbkg/0HSVti25Fu4rmd1oCR6NGWe9vqTWuWv3GcNA==}
hasBin: true
+ resolution: {integrity: sha512-Vdw0ATsQ9V+LuegM/BTwQqV/6cTl5lbGcIrU+BCgLxyf6bo38ybOr372tuSIxir3CN720flu1meYR6XzNMwQnw==}
+ hasBin: true
+
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
@@ -6017,6 +6044,9 @@ packages:
resolution: {integrity: sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==}
+ resolution: {integrity: sha512-Tl9GBNeG/AhJnQM221bJR2HPvLOSnLE/T9cJI9tlc6zwQk2nPk/4f0cHkOdEixQPC/j8UtKDdITswvLAy1OZ1w==}
+
resolution: {integrity: sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==}
@@ -6126,6 +6156,9 @@ packages:
resolution: {integrity: sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==}
+ resolution: {integrity: sha512-lvEqd+fHjATVs+2v/8kg9i5Q0AP2k85H0WUOwpIVvUML8BapsMvh1XAogmQjOCsLpoKRCVQqEkQBB3NhVBcsOg==}
+
resolution: {integrity: sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q==}
@@ -6890,6 +6923,9 @@ packages:
resolution: {integrity: sha512-Qn7vR1xrf6fZCrkm9TDWi/AB4ylrHy+jqsNm1EHOAmbARYA6gsnVJBq/sdBh6kmT4NEZxH5vgIjrscefJAOXcw==}
+ resolution: {integrity: sha512-OiM2wrZ/wuhKkigASodFoo8wimG3H12LWQaH8qSPVJn9apWKFSH3YOCtbKpBorTVw/eI7cuT21XBbvwEswbIOA==}
+
resolution: {integrity: sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag==}
@@ -6934,6 +6970,9 @@ packages:
resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==}
+ resolution: {integrity: sha512-MMqgnP74Igy+S3WwnhQ7kqGlEerTETXMvJhrUzDikVZ2/uogJCb+WHUg97hK9/jcfc0dkD73s3LN8zU49cTEtA==}
+
resolution: {integrity: sha512-Pjj2IYlUY3+D8x00UJsIOg5BEvfMyeI+2uLPn9VO9Wg4MEtN/VTIq2NEJQfde9PnX15KgtHyl9S0BcTnWrIuWg==}
@@ -7655,6 +7694,9 @@ packages:
resolution: {integrity: sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==}
+
resolution: {integrity: sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==}
@@ -7664,6 +7706,9 @@ packages:
resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==}
+ resolution: {integrity: sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==}
+
resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==}
@@ -10437,6 +10482,15 @@ snapshots:
- micromark-util-types
- unified
+ dependencies:
+ katex: 0.16.45
+ react: 19.2.6
+ rehype-katex: 7.0.1
+ remark-math: 6.0.0
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
mermaid: 11.14.0
@@ -10973,6 +11027,8 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
dependencies:
'@types/unist': 3.0.3
@@ -12548,8 +12604,8 @@ snapshots:
'@next/eslint-plugin-next': 16.2.6
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
+ eslint-plugin-import: 2.32.0([email protected])([email protected]([email protected]))
eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))
eslint-plugin-react: 7.37.5([email protected]([email protected]))
eslint-plugin-react-hooks: 7.1.1([email protected]([email protected]))
@@ -12571,7 +12627,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.3
@@ -12582,21 +12638,21 @@ snapshots:
tinyglobby: 0.2.16
unrs-resolver: 1.11.1
optionalDependencies:
+ eslint-plugin-import: 2.32.0([email protected])([email protected]([email protected]))
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
transitivePeerDependencies:
- supports-color
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@@ -12607,7 +12663,7 @@ snapshots:
doctrine: 2.1.0
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
hasown: 2.0.3
is-core-module: 2.16.2
is-glob: 4.0.3
@@ -13313,6 +13369,19 @@ snapshots:
dependencies:
function-bind: 1.1.2
+ dependencies:
+ '@types/hast': 3.0.4
+ hastscript: 9.0.1
+ web-namespaces: 2.0.1
+
+ dependencies:
+ '@types/hast': 3.0.4
+ hast-util-from-dom: 5.0.1
+ hast-util-from-html: 2.0.3
+ unist-util-remove-position: 5.0.0
+
dependencies:
'@types/hast': 3.0.4
@@ -13436,6 +13505,13 @@ snapshots:
dependencies:
'@types/hast': 3.0.4
+ dependencies:
+ '@types/hast': 3.0.4
+ '@types/unist': 3.0.3
+ hast-util-is-element: 3.0.0
+ unist-util-find-after: 5.0.0
+
dependencies:
'@types/hast': 3.0.4
@@ -13853,6 +13929,10 @@ snapshots:
dependencies:
commander: 8.3.0
+ dependencies:
+ commander: 8.3.0
+
dependencies:
json-buffer: 3.0.1
@@ -14175,6 +14255,18 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ '@types/hast': 3.0.4
+ '@types/mdast': 4.0.4
+ devlop: 1.1.0
+ longest-streak: 3.1.0
+ mdast-util-from-markdown: 2.0.3
+ mdast-util-to-markdown: 2.1.2
+ unist-util-remove-position: 5.0.0
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
'@types/estree-jsx': 1.0.5
@@ -14406,6 +14498,16 @@ snapshots:
micromark-util-combine-extensions: 2.0.1
micromark-util-types: 2.0.2
+ dependencies:
+ '@types/katex': 0.16.8
+ devlop: 1.1.0
+ katex: 0.16.45
+ micromark-factory-space: 2.0.1
+ micromark-util-character: 2.1.1
+ micromark-util-symbol: 2.0.1
+ micromark-util-types: 2.0.2
+
dependencies:
'@types/estree': 1.0.9
@@ -15422,6 +15524,16 @@ snapshots:
dependencies:
unist-util-visit: 5.1.0
+ dependencies:
+ '@types/hast': 3.0.4
+ '@types/katex': 0.16.8
+ hast-util-from-html-isomorphic: 2.0.0
+ hast-util-to-text: 4.0.2
+ katex: 0.16.45
+ unist-util-visit-parents: 6.0.2
+ vfile: 6.0.3
+
dependencies:
'@types/hast': 3.0.4
@@ -15496,6 +15608,15 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ '@types/mdast': 4.0.4
+ mdast-util-math: 3.0.0
+ micromark-extension-math: 3.1.0
+ unified: 11.0.5
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
mdast-util-mdx: 3.0.0
@@ -16431,6 +16552,11 @@ snapshots:
dependencies:
crypto-random-string: 2.0.0
+ dependencies:
+ '@types/unist': 3.0.3
+ unist-util-is: 6.0.1
+
dependencies:
'@types/unist': 3.0.3
@@ -16443,6 +16569,11 @@ snapshots:
dependencies:
'@types/unist': 3.0.3
+ dependencies:
+ '@types/unist': 3.0.3
+ unist-util-visit: 5.1.0
+
dependencies:
'@types/unist': 3.0.3
diff --git a/src/web/package.json b/src/web/package.json
index 8df3befc9..59b9b63fd 100644
--- a/src/web/package.json
+++ b/src/web/package.json
@@ -35,6 +35,7 @@
"@next/third-parties": "^16.2.6",
"@opennextjs/cloudflare": "^1.19.11",
"@streamdown/cjk": "^1.0.3",
+ "@streamdown/math": "^1.0.2",
"@streamdown/mermaid": "^1.0.2",
"@tiptap/extension-image": "^3.23.6",
"@tiptap/extension-link": "^3.23.6",
@@ -54,6 +55,7 @@
"gsap": "^3.15.0",
"idb": "^8.0.3",
"input-otp": "^1.4.2",
+ "katex": "^0.17.0",
"lucide-react": "^1.16.0",
"nanoid": "^5.1.11",
"next": "16.2.6",
diff --git a/src/web/src/app/globals.css b/src/web/src/app/globals.css
index 223dd1f81..97c8564fb 100644
--- a/src/web/src/app/globals.css
+++ b/src/web/src/app/globals.css
@@ -1,9 +1,11 @@
@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";
+@import "katex/dist/katex.min.css";
@source "../node_modules/streamdown/dist/*.js";
@source "../node_modules/@streamdown/mermaid/dist/*.js";
@source "../node_modules/@streamdown/cjk/dist/*.js";
+@source "../node_modules/@streamdown/math/dist/*.js";
@custom-variant dark (&:is(.dark *));
@@ -1451,20 +1453,77 @@ html.dark .blog-content [data-rehype-pretty-code-figure] span {
pointer-events: auto !important;
}
-/* ── Streamdown code block actions: show on hover ── */
-[data-streamdown="code-block-actions"] {
+/* ── Streamdown block actions: unified styling (matches MessageActionsToolbar) ── */
+[data-streamdown="code-block-actions"],
+[data-streamdown="mermaid-block-actions"],
+[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) {
opacity: 0;
pointer-events: none;
transition: opacity 150ms ease;
- background: oklch(0.25 0.01 60) !important;
- border-color: oklch(1 0.005 80 / 12%) !important;
- color: #e1e4e8 !important;
-}
-[data-streamdown="code-block-actions"] button:hover {
+ background: oklch(0.2 0.01 60 / 80%) !important;
+ backdrop-filter: blur(4px);
+ border: 1px solid oklch(1 0 0 / 10%) !important;
+ border-radius: 0.5rem !important;
+ color: rgba(255, 255, 255, 0.7) !important;
+ padding: 0.125rem !important;
+ gap: 0.125rem !important;
+}
+[data-streamdown="code-block-actions"] button,
+[data-streamdown="mermaid-block-actions"] button,
+[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) button {
+ width: 1.5rem !important;
+ height: 1.5rem !important;
+ padding: 0 !important;
+ display: flex !important;
+ align-items: center !important;
+ justify-content: center !important;
+ border-radius: 0.375rem !important;
+ color: rgba(255, 255, 255, 0.7) !important;
+ transition: color 150ms ease !important;
+}
+[data-streamdown="code-block-actions"] button:hover,
+[data-streamdown="mermaid-block-actions"] button:hover,
+[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) button:hover {
color: #ffffff !important;
}
-.dark [data-streamdown="code-block-actions"] {
- background: oklch(0.22 0.008 60) !important;
+[data-streamdown="code-block-actions"] button svg,
+[data-streamdown="mermaid-block-actions"] button svg,
+[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) button svg {
+ width: 0.875rem !important;
+ height: 0.875rem !important;
+}
+
+/* ── Streamdown block actions: dropdown popups ── */
+[data-streamdown="code-block-actions"] .absolute,
+[data-streamdown="mermaid-block-actions"] .absolute,
+[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) .absolute {
+ z-index: 50 !important;
+ min-width: 8rem;
+ width: max-content !important;
+ overflow: visible !important;
+ background: var(--background) !important;
+ border: 1px solid var(--border) !important;
+ border-radius: var(--radius-md) !important;
+ color: var(--foreground) !important;
+ box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
+ padding: 0.25rem !important;
+}
+[data-streamdown="code-block-actions"] .absolute button,
+[data-streamdown="mermaid-block-actions"] .absolute button,
+[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) .absolute button {
+ width: 100% !important;
+ height: auto !important;
+ display: flex !important;
+ padding: 0.375rem 0.625rem !important;
+ border-radius: var(--radius-sm) !important;
+ color: var(--foreground) !important;
+ cursor: pointer !important;
+}
+[data-streamdown="code-block-actions"] .absolute button:hover,
+[data-streamdown="mermaid-block-actions"] .absolute button:hover,
+[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) .absolute button:hover {
+ background: oklch(1 0 0 / 8%) !important;
+ color: var(--foreground) !important;
}
[data-streamdown="code-block"]:hover [data-streamdown="code-block-actions"] {
opacity: 1;
@@ -1520,23 +1579,13 @@ html.dark .blog-content [data-rehype-pretty-code-figure] span {
pointer-events: auto;
}
-/* Actions buttons: fade in on hover */
-[data-streamdown="mermaid-block-actions"] {
- opacity: 0;
- transition: opacity 150ms ease;
-}
+/* Mermaid actions: hover reveal */
[data-streamdown="mermaid-block"]:hover [data-streamdown="mermaid-block-actions"] {
opacity: 1;
+ pointer-events: auto;
}
-/* Mermaid download dropdown menu */
-[data-streamdown="mermaid-block-actions"] .absolute {
- z-index: 50 !important;
- min-width: 10rem;
- color: var(--foreground) !important;
- background: var(--background) !important;
- border-color: var(--border) !important;
-}
+/* Mermaid download dropdown menu — covered by unified dropdown rule above */
/* Diagram content area */
[data-streamdown="mermaid-block"] > div:last-child {
@@ -1612,27 +1661,20 @@ html.dark .blog-content [data-rehype-pretty-code-figure] span {
border-bottom: 1px solid var(--border) !important;
}
-/* Actions row: anchor top-right, show on hover (outside @layer so it always applies) */
+/* Table actions: position + hover reveal */
[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) {
position: absolute !important;
top: 0.375rem;
right: 0.375rem;
z-index: 10;
margin: 0 !important;
- opacity: 0;
- pointer-events: none;
- transition: opacity 150ms ease;
}
[data-streamdown="table-wrapper"]:hover > div:first-child:not(:has([data-streamdown="table"])) {
opacity: 1;
pointer-events: auto;
}
-/* Table copy/download dropdown: escape parent overflow clip */
-[data-streamdown="table-wrapper"] > div:first-child:not(:has([data-streamdown="table"])) .absolute {
- min-width: 10rem;
- overflow: visible !important;
-}
+/* Table copy/download dropdown — covered by unified dropdown rule above */
/* Thin scrollbar for table container */
[data-streamdown="table-wrapper"] > div:has([data-streamdown="table"])::-webkit-scrollbar {
@@ -1649,19 +1691,58 @@ html.dark .blog-content [data-rehype-pretty-code-figure] span {
background: var(--muted-foreground);
}
-/* ── Streamdown table fullscreen: enable horizontal scroll for wide tables ── */
+/* ── Streamdown fullscreen views: unified styling ── */
+/* Mermaid fullscreen (portaled to body): unified background */
+.fixed.inset-0.z-50.bg-background\/95.backdrop-blur-sm {
+ background: oklch(0.1 0.01 60 / 95%) !important;
+ backdrop-filter: blur(8px) !important;
+}
+/* Mermaid fullscreen: apply same node styling as in-bubble */
+.fixed.inset-0.z-50.bg-background\/95 .node rect,
+.fixed.inset-0.z-50.bg-background\/95 .node .basic {
+ rx: 8 !important;
+ ry: 8 !important;
+}
+/* Table fullscreen */
[data-streamdown="table-fullscreen"] {
+ background: oklch(0.1 0.01 60 / 95%) !important;
+ backdrop-filter: blur(8px);
overflow: hidden;
}
+/* Content area: centered with max-width for readability */
[data-streamdown="table-fullscreen"] .flex-1.overflow-auto {
overflow: auto !important;
display: flex !important;
align-items: center;
+ justify-content: center !important;
+ padding: 1rem !important;
+}
+[data-streamdown="table-fullscreen"] .flex-1.overflow-auto > * {
+ max-width: 64rem !important;
+ width: 100% !important;
}
[data-streamdown="table-fullscreen"] [data-streamdown="table"] {
width: max-content !important;
min-width: 100%;
}
+/* Table fullscreen close button: match mermaid's absolute top-right style */
+[data-streamdown="table-fullscreen"] > div > div:first-child {
+ position: absolute !important;
+ top: 0;
+ right: 0;
+ z-index: 10;
+ padding: 1rem !important;
+}
+[data-streamdown="table-fullscreen"] > div > div:first-child button {
+ padding: 0.5rem !important;
+ border-radius: var(--radius-md) !important;
+ color: var(--muted-foreground) !important;
+ transition: all 150ms ease !important;
+}
+[data-streamdown="table-fullscreen"] > div > div:first-child button:hover {
+ background: var(--muted) !important;
+ color: var(--foreground) !important;
+}
/* ── Task highlight (activity page scroll-to-task) ── */
.task-highlight {
diff --git a/src/web/src/components/agent-chat/message-list.tsx b/src/web/src/components/agent-chat/message-list.tsx
index 861ea73ed..e67527a4b 100644
--- a/src/web/src/components/agent-chat/message-list.tsx
+++ b/src/web/src/components/agent-chat/message-list.tsx
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button";
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
import { Sheet, SheetContent } from "@/components/ui/sheet";
import { Streamdown } from "streamdown";
-import { mermaid, cjk } from "@/lib/streamdown-plugins";
+import { mermaid, cjk, math } from "@/lib/streamdown-plugins";
import { highlightMentions } from "@/lib/highlight-mentions";
import { TaskStream } from "@/components/task-stream";
import { RuntimeErrorBlock } from "@/components/agent-chat/runtime-error-block";
@@ -594,7 +594,7 @@ export const MessageItem = memo(function MessageItem({
)}
{messageBody && (
<div className="markdown markdown-user">
- <Streamdown plugins={{ mermaid, cjk }} controls={{ code: { copy: true, download: false }, table: { copy: false, download: false, fullscreen: false } }} linkSafety={{ enabled: false }} allowedTags={MENTION_ALLOWED_TAGS} literalTagContent={MENTION_LITERAL_TAGS} components={mentionComponents}>{highlightMentions(messageBody, agents)}</Streamdown>
+ <Streamdown plugins={{ mermaid, cjk, math }} controls={{ code: { copy: true, download: false }, table: { copy: false, download: false, fullscreen: false } }} linkSafety={{ enabled: false }} allowedTags={MENTION_ALLOWED_TAGS} literalTagContent={MENTION_LITERAL_TAGS} components={mentionComponents}>{highlightMentions(messageBody, agents)}</Streamdown>
</div>
)}
{(() => {
@@ -704,7 +704,7 @@ export const MessageItem = memo(function MessageItem({
// whether or not the toolbar/sheet is open (bubble-only).
isFlagged && "shadow-[inset_2px_0_0_var(--foreground)]",
)}>
- <Streamdown plugins={{ mermaid, cjk }} controls={{ code: { copy: true, download: false }, table: { copy: true, download: false, fullscreen: true } }} linkSafety={{ enabled: false }} allowedTags={MENTION_ALLOWED_TAGS} literalTagContent={MENTION_LITERAL_TAGS} components={mentionComponents}>{highlightMentions(msg.content, agents)}</Streamdown>
+ <Streamdown plugins={{ mermaid, cjk, math }} controls={{ code: { copy: true, download: false }, table: { copy: true, download: false, fullscreen: true } }} linkSafety={{ enabled: false }} allowedTags={MENTION_ALLOWED_TAGS} literalTagContent={MENTION_LITERAL_TAGS} components={mentionComponents}>{highlightMentions(msg.content, agents)}</Streamdown>
</div>
{isFlagged && <FlagDot />}
{toolbar}
diff --git a/src/web/src/lib/streamdown-plugins.ts b/src/web/src/lib/streamdown-plugins.ts
index e6c8d58eb..55e06a18c 100644
--- a/src/web/src/lib/streamdown-plugins.ts
+++ b/src/web/src/lib/streamdown-plugins.ts
@@ -1,4 +1,5 @@
import { createMermaidPlugin } from "@streamdown/mermaid";
+import { createMathPlugin } from "@streamdown/math";
export { cjk } from "@streamdown/cjk";
export const mermaid = createMermaidPlugin({
@@ -25,3 +26,7 @@ export const mermaid = createMermaidPlugin({
fontFamily: "ui-sans-serif, system-ui, sans-serif",
},
});
+
+export const math = createMathPlugin({
+ singleDollarTextMath: true,
+});