Skip to content

Commit d8adcf6

Browse files
authored
feat: Streamdown support (#240)
* Replace react-markdown with Streamdown * Update checksum.ts * Bump Streamdown * Update checksum.ts * Update tanchat.css * Update checksum.ts * Bump Streamdown * Update checksum.ts * fix: Streamdown imports * fix: checksum --------- Authored-by: Hayden Bleasel <[email protected]>
1 parent 4d8ce08 commit d8adcf6

File tree

8 files changed

+705
-227
lines changed

8 files changed

+705
-227
lines changed

examples/react-cra/ecommerce-starter/package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,22 @@
2626
"lucide-react": "^0.475.0",
2727
"react": "^19.0.0",
2828
"react-dom": "^19.0.0",
29-
"react-markdown": "^9.0.1",
30-
"rehype-highlight": "^7.0.0",
31-
"rehype-raw": "^7.0.0",
32-
"rehype-sanitize": "^6.0.0",
33-
"remark-gfm": "^4.0.1",
29+
"streamdown": "^1.6.5",
3430
"tailwindcss": "^4.0.6",
3531
"vite-tsconfig-paths": "^5.1.4",
3632
"zod": "^3.24.2"
3733
},
3834
"devDependencies": {
3935
"@content-collections/core": "^0.8.2",
4036
"@content-collections/vite": "^0.2.6",
37+
"@tanstack/react-start-plugin": "^1.131.11",
38+
"@tanstack/router-generator": "1.120.20",
39+
"@tanstack/start": "^1.120.20",
4140
"@testing-library/dom": "^10.4.0",
4241
"@testing-library/react": "^16.2.0",
4342
"@types/react": "^19.0.8",
4443
"@types/react-dom": "^19.0.3",
4544
"@vitejs/plugin-react": "^4.3.4",
46-
"@tanstack/router-generator": "1.120.20",
47-
"@tanstack/start": "^1.120.20",
48-
"@tanstack/react-start-plugin": "^1.131.11",
4945
"jsdom": "^26.0.0",
5046
"typescript": "^5.7.2",
5147
"vite": "^7.1.7",

examples/react-cra/ecommerce-starter/starter.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

frameworks/react-cra/examples/tanchat/assets/src/components/example-AIAssistant.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import { useStore } from '@tanstack/react-store'
33
import { Store } from '@tanstack/store'
44

55
import { Send, X, ChevronRight } from 'lucide-react'
6-
import ReactMarkdown from 'react-markdown'
7-
import rehypeRaw from 'rehype-raw'
8-
import rehypeSanitize from 'rehype-sanitize'
9-
import rehypeHighlight from 'rehype-highlight'
10-
import remarkGfm from 'remark-gfm'
6+
import { Streamdown } from 'streamdown'
117

128
import { useChat } from '@ai-sdk/react'
139
import { DefaultChatTransport } from 'ai'
@@ -61,16 +57,7 @@ function Messages({ messages }: { messages: Array<UIMessage> }) {
6157
</div>
6258
)}
6359
<div className="flex-1 min-w-0 text-white prose dark:prose-invert max-w-none prose-sm">
64-
<ReactMarkdown
65-
rehypePlugins={[
66-
rehypeRaw,
67-
rehypeSanitize,
68-
rehypeHighlight,
69-
remarkGfm,
70-
]}
71-
>
72-
{part.text}
73-
</ReactMarkdown>
60+
<Streamdown>{part.text}</Streamdown>
7461
</div>
7562
</div>
7663
)

frameworks/react-cra/examples/tanchat/assets/src/routes/demo/tanchat.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import "tailwindcss";
22
@import "highlight.js/styles/github-dark.css";
3+
@source "../../../../node_modules/streamdown/dist/*.js";
34

45
/* Custom scrollbar styles */
56
::-webkit-scrollbar {

frameworks/react-cra/examples/tanchat/assets/src/routes/demo/tanchat.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { useEffect, useRef, useState } from 'react'
22
import { createFileRoute } from '@tanstack/react-router'
33
import { Send } from 'lucide-react'
4-
import ReactMarkdown from 'react-markdown'
5-
import rehypeRaw from 'rehype-raw'
6-
import rehypeSanitize from 'rehype-sanitize'
7-
import rehypeHighlight from 'rehype-highlight'
8-
import remarkGfm from 'remark-gfm'
4+
import { Streamdown } from 'streamdown'
95
import { useChat } from '@ai-sdk/react'
106
import { DefaultChatTransport } from 'ai'
117

@@ -87,16 +83,7 @@ function Messages({ messages }: { messages: Array<UIMessage> }) {
8783
className="flex-1 min-w-0 prose dark:prose-invert max-w-none prose-sm"
8884
key={index}
8985
>
90-
<ReactMarkdown
91-
rehypePlugins={[
92-
rehypeRaw,
93-
rehypeSanitize,
94-
rehypeHighlight,
95-
remarkGfm,
96-
]}
97-
>
98-
{part.text}
99-
</ReactMarkdown>
86+
<Streamdown>{part.text}</Streamdown>
10087
</div>
10188
)
10289
}

frameworks/react-cra/examples/tanchat/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66
"@modelcontextprotocol/sdk": "^1.8.0",
77
"ai": "^5.0.8",
88
"highlight.js": "^11.11.1",
9-
"react-markdown": "^10.1.0",
10-
"rehype-highlight": "^7.0.0",
11-
"rehype-raw": "^7.0.0",
12-
"rehype-sanitize": "^6.0.0",
13-
"remark-gfm": "^4.0.1",
9+
"streamdown": "^1.6.5",
1410
"lucide-react": "^0.544.0",
1511
"zod": "^4.1.11"
1612
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// This file is auto-generated. Do not edit manually.
22
// Generated from add-ons, examples, hosts, project, and toolchains directories
3-
export const contentChecksum = '560febef815f93ec3c99b747912b7b52a249a731dea9fd5c74eb3f1f6488e6d8'
3+
export const contentChecksum = 'ed82e6b4b77aaf2d3ded6c3002d319c79eb68328b4e6ad1333211f106a978482'

0 commit comments

Comments
 (0)