Skip to content

[Fix] Integrate Markdansi for proper markdown rendering #117

@randomm

Description

@randomm

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 ANSI

Package

  • 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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions