How It Works
Backend: Markdown in Responses
The system prompt instructs models to use markdown formatting, including fenced code blocks:lib/ai/prompts.ts
Frontend: Streamdown Rendering
TheResponse component wraps Streamdown, a markdown renderer optimized for AI streaming:
components/ai-elements/response.tsx
- Syntax highlighting for 100+ languages via Shiki
- Streaming-safe parsing that doesn’t break mid-token
- Mermaid diagrams rendered inline
- Math equations with KaTeX support
- Tables, lists, and formatting with proper styling
Supported Languages
Streamdown supports all languages supported by Shiki, including:| Category | Languages |
|---|---|
| Web | TypeScript, JavaScript, HTML, CSS, JSON |
| Backend | Python, Go, Rust, Java, C#, Ruby, PHP |
| Systems | C, C++, Zig, Assembly |
| Data | SQL, GraphQL, YAML, TOML |
| Shell | Bash, PowerShell, Fish |
| Markup | Markdown, LaTeX, XML |