Skip to content

Commit 0330b8a

Browse files
Migrate vibecoding examples from React-Markdown to Streamdown (#1307)
### Description This pull request refactors the rendering of markdown-like content across both the Vibe Coding Platform and Python IDE frontend by replacing all usages of `react-markdown` (and related plugins) with the new `Streamdown` component. This change streamlines markdown rendering, removes custom renderer code, and updates dependencies accordingly. **Rendering changes:** * Replaced all instances of `MarkdownRenderer` and `react-markdown` with the `Streamdown` component in chat message components, including `reasoning.tsx`, `report-errors.tsx`, `run-command.tsx`, `text.tsx`, and the Python IDE's `ChatTimeline`. This ensures consistent markdown rendering using `Streamdown` throughout the application. [[1]](diffhunk://#diff-b18939f0843715ec8c0666a86ac3a40aeb74a949d75ed4a4c7044509c6c5f140L2-R4) [[2]](diffhunk://#diff-b18939f0843715ec8c0666a86ac3a40aeb74a949d75ed4a4c7044509c6c5f140L40-R40) [[3]](diffhunk://#diff-bf6adb853c9bf0f1477299bafde4fe12e16e1a1ec04f57345ed2fb0fa700fb4dL5-R5) [[4]](diffhunk://#diff-bf6adb853c9bf0f1477299bafde4fe12e16e1a1ec04f57345ed2fb0fa700fb4dL19-R19) [[5]](diffhunk://#diff-fc0c7defb7085883bf5dd5398baba17a38098ce843b4743034fc1a37f0dfa001L6-R6) [[6]](diffhunk://#diff-fc0c7defb7085883bf5dd5398baba17a38098ce843b4743034fc1a37f0dfa001L32-R34) [[7]](diffhunk://#diff-72b605cc3f8ad8db3dba8de42ffaccb69e2e2340cfb934e6a7dcfa9d870f2afbL2-R7) [[8]](diffhunk://#diff-0bc316cdaf20986080d11e3ce067606ddadf03f0651b580e1f746eec5c8133bfL2-R2) [[9]](diffhunk://#diff-0bc316cdaf20986080d11e3ce067606ddadf03f0651b580e1f746eec5c8133bfL92-R91) [[10]](diffhunk://#diff-0bc316cdaf20986080d11e3ce067606ddadf03f0651b580e1f746eec5c8133bfL467-R464) * Removed the custom `MarkdownRenderer` component and its associated code, as it is no longer needed with the adoption of `Streamdown`. **Dependency and configuration updates:** * Updated `package.json` files to remove `react-markdown`, `remark-gfm`, and `rehype-raw` dependencies and add `streamdown` as a new dependency for both projects. [[1]](diffhunk://#diff-3c8075b8a95131416e3856c63c1c28bdb94a30f320b0065b2ce9586e91168dccL40-L45) [[2]](diffhunk://#diff-76ef8e0a9755e6f1a85dd18d222ac6ace40e838e7f21a552e2b1592247946ab1L25-R25) * Updated Tailwind and build configuration files to include `streamdown`'s distribution files for proper styling and integration. [[1]](diffhunk://#diff-72477083d1a4198c17e7ca54cf97560fc108079f3ea55004730eb5fb99367d6cR3) [[2]](diffhunk://#diff-261c16ce1a55260f7746845509ed30efc060338b4af10c1bd5f3da8d041f852eR7) ### Demo URL Awaiting preview deploy. ### Type of Change - [ ] New Example - [x] Example updates (Bug fixes, new features, etc.) - [ ] Other (changes to the codebase, but not to examples)
1 parent 6a89bca commit 0330b8a

File tree

12 files changed

+2939
-183
lines changed

12 files changed

+2939
-183
lines changed

apps/vibe-coding-platform/app/globals.css

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

45
:root {
56
--background: rgb(255, 255, 255);

apps/vibe-coding-platform/components/chat/message-part/reasoning.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ReasoningUIPart } from 'ai'
2-
import { MarkdownRenderer } from '@/components/markdown-renderer/markdown-renderer'
32
import { MessageSpinner } from '../message-spinner'
43
import { useReasoningContext } from '../message'
4+
import { Streamdown } from 'streamdown'
55

66
export function Reasoning({
77
part,
@@ -37,7 +37,7 @@ export function Reasoning({
3737
<div className="px-3 py-2">
3838
<div className="text-secondary-foreground font-mono leading-normal">
3939
{isExpanded || !hasMoreContent ? (
40-
<MarkdownRenderer content={text} />
40+
<Streamdown>{text}</Streamdown>
4141
) : (
4242
<div className="overflow-hidden">{firstLine}</div>
4343
)}

apps/vibe-coding-platform/components/chat/message-part/report-errors.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { DataPart } from '@/ai/messages/data-parts'
22
import { BugIcon } from 'lucide-react'
33
import { ToolHeader } from '../tool-header'
44
import { ToolMessage } from '../tool-message'
5-
import Markdown from 'react-markdown'
5+
import { Streamdown } from 'streamdown'
66

77
export function ReportErrors({
88
message,
@@ -16,7 +16,7 @@ export function ReportErrors({
1616
<span>Auto-detected errors</span>
1717
</ToolHeader>
1818
<div className="relative min-h-5">
19-
<Markdown>{message.summary}</Markdown>
19+
<Streamdown>{message.summary}</Streamdown>
2020
</div>
2121
</ToolMessage>
2222
)

apps/vibe-coding-platform/components/chat/message-part/run-command.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CheckIcon, SquareChevronRightIcon, XIcon } from 'lucide-react'
33
import { Spinner } from './spinner'
44
import { ToolHeader } from '../tool-header'
55
import { ToolMessage } from '../tool-message'
6-
import Markdown from 'react-markdown'
6+
import { Streamdown } from 'streamdown'
77

88
export function RunCommand({ message }: { message: DataPart['run-command'] }) {
99
return (
@@ -29,9 +29,9 @@ export function RunCommand({ message }: { message: DataPart['run-command'] }) {
2929
<CheckIcon className="w-4 h-4" />
3030
)}
3131
</Spinner>
32-
<Markdown>{`\`${message.command} ${message.args.join(
32+
<Streamdown>{`\`${message.command} ${message.args.join(
3333
' '
34-
)}\``}</Markdown>
34+
)}\``}</Streamdown>
3535
</div>
3636
</ToolMessage>
3737
)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { TextUIPart } from 'ai'
2-
import { MarkdownRenderer } from '@/components/markdown-renderer/markdown-renderer'
2+
import { Streamdown } from 'streamdown'
33

44
export function Text({ part }: { part: TextUIPart }) {
55
return (
66
<div className="text-sm px-3.5 py-3 border bg-secondary/90 text-secondary-foreground border-gray-300 rounded-md font-mono">
7-
<MarkdownRenderer content={part.text} />
7+
<Streamdown>{part.text}</Streamdown>
88
</div>
99
)
1010
}

apps/vibe-coding-platform/components/markdown-renderer/markdown-renderer.tsx

Lines changed: 0 additions & 96 deletions
This file was deleted.

apps/vibe-coding-platform/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@
3737
"nuqs": "2.4.3",
3838
"react": "19.1.0",
3939
"react-dom": "19.1.0",
40-
"react-markdown": "10.1.0",
40+
"streamdown": "^1.6.6",
4141
"react-resizable-panels": "3.0.4",
4242
"react-spinners": "0.17.0",
4343
"react-syntax-highlighter": "15.6.1",
44-
"rehype-raw": "7.0.0",
45-
"remark-gfm": "4.0.1",
4644
"sonner": "^2.0.6",
4745
"strip-ansi": "7.1.0",
4846
"swr": "2.3.4",

0 commit comments

Comments
 (0)