forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
Current markdown renderer (cli/lite/markdown.ts) is broken:
- Bold text not showing
- Code blocks show raw backticks
wrap()function corrupts ANSI escape codes
Solution
Replace with Markdansi — purpose-built for streaming LLM output.
Benefits
| Feature | Current | With Markdansi |
|---|---|---|
| Bold | ❌ broken | ✅ |
| Code blocks | ❌ shows backticks | ✅ with box, gutter |
| Tables | ❌ | ✅ GFM, unicode |
| Hyperlinks | ❌ | ✅ OSC-8 |
| Streaming | ❌ breaks mid-token | ✅ hybrid buffering |
Integration
import { createMarkdownStreamer, render } from "markdansi"
const streamer = createMarkdownStreamer({
render: (md) => render(md, { width: 80, theme: "default" }),
mode: "hybrid",
})
// Stream: streamer.push(chunk) → ANSI string
// Finish: streamer.finish() → final ANSIPackage
- npm: markdansi
- Size: ~70KB
- Node: >=22 (matches oclite)
- License: MIT
Acceptance Criteria
- Replace markdown.ts with Markdansi wrapper
- Bold, code, headers render correctly
- Streaming works without breaking mid-token
Metadata
Metadata
Assignees
Labels
No labels