improvement: use Streamdown for markdown rendering#174
improvement: use Streamdown for markdown rendering#174jeseed merged 3 commits intoCedarCopilot:mainfrom
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR migrates the Cedar OS markdown rendering system from react-markdown to Streamdown, a library specifically designed for streaming AI content. The changes span four key files:
-
MarkdownRenderer Component: The core component has been significantly simplified, removing over 200 lines of custom component definitions, code block functionality (syntax highlighting, copy buttons), and sophisticated styling integration. The new implementation uses Streamdown's
parseIncompleteMarkdownfeature with minimal component overrides that hardcode black text styling. -
Package Dependencies: The
cedar-os-componentspackage.json removes react-markdown and remark-gfm dependencies, replacing them with streamdown v1.3.0. This aligns with the architectural shift toward a streaming-focused markdown solution. -
Documentation Update: The markdown-renderer.mdx documentation has been drastically simplified from detailed feature descriptions to a basic overview focused on Streamdown integration, including examples of streaming AI content integration.
-
CSS Integration Attempt: A problematic addition to globals.css attempts to include Streamdown's JavaScript using an invalid
@sourcedirective, which is not valid CSS syntax and will be ignored by browsers.
The migration appears motivated by leveraging Streamdown's specialized capabilities for parsing incomplete markdown during AI streaming responses, which is crucial for Cedar OS's AI-native application framework. However, the implementation sacrifices significant functionality including code syntax highlighting, copy-to-clipboard features, and proper integration with the existing design system.
Confidence score: 1/5
- This PR introduces critical functionality regressions and contains fundamentally broken CSS syntax that will prevent proper library loading
- Score reflects the invalid CSS
@sourcedirective, loss of essential features like code highlighting, hardcoded styling that bypasses the design system, and potential XSS vulnerabilities - Pay close attention to packages/cedar-os/src/styles/globals.css and packages/cedar-os-components/chatMessages/MarkdownRenderer.tsx for immediate fixes needed
4 files reviewed, 2 comments
refs #148
checkout streamdown: https://github.com/vercel/streamdown