Skip to content

feat(tui): render full CommonMark in assistant answers - #259

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/full-markdown-rendering
Aug 5, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/full-markdown-rendering

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

What

The old hand-rolled renderer handled only fenced code, headings, list bullets, inline **bold**, and backticks. Everything else — tables, links, nested lists, block quotes, italics, strikethrough, task lists, rules — fell through as literal markup in the conversation panel.

Fix

Replace it with a pulldown-cmark event-stream renderer in crates/forge-tui/src/markdown.rs that maps parsed CommonMark onto ratatui Lines:

  • headings, emphasis, strong, strikethrough, inline code
  • nested ordered/unordered/task lists
  • block quotes
  • syntax-highlighted fenced code
  • wrapped tables (with ┼ separators)
  • links (underlined), images (alt text), footnotes, rules
  • raw HTML passthrough

Parsing is 100% pulldown-cmark; the TUI only reacts to parsed events for styling — no manual tag/string sniffing (the old strip_prefix("# ") / find("**") code is deleted).

Unterminated-fence behavior for streaming answers is preserved (partial blocks still render, no synthetic closing fence).

Validation

  • cargo fmt --all -- --check clean
  • cargo clippy --workspace --all-targets --locked -- -D warnings clean
  • cargo test --workspace --all-targets --locked: forge-tui 743 passed; only known failures are the 3 pre-existing environmental forge-config permissions tests (read the developer's real user-level permissions.toml, unrelated to this change)

The hand-rolled renderer only handled fenced code, headings, list bullets,
inline bold, and backticks — everything else (tables, links, nested lists,
quotes, italics, strikethrough) fell through as literal markup.

Replace it with a pulldown-cmark event-stream renderer that maps parsed
CommonMark onto ratatui Lines: headings, emphasis, strikethrough, nested
ordered/unordered/task lists, block quotes, syntax-highlighted fenced code,
wrapped tables, links, images (alt text), footnotes, rules, and raw HTML
passthrough. Parsing stays fully in pulldown-cmark; the TUI only reacts to
parsed events for styling, so no syntax is hand-sniffed.

Unterminated fence behavior is preserved for streaming answers.
@github-actions
github-actions Bot enabled auto-merge (squash) August 5, 2026 11:11
@github-actions
github-actions Bot merged commit 5df6528 into main Aug 5, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
The hand-rolled renderer only handled fenced code, headings, list bullets,
inline bold, and backticks — everything else (tables, links, nested lists,
quotes, italics, strikethrough) fell through as literal markup.

Replace it with a pulldown-cmark event-stream renderer that maps parsed
CommonMark onto ratatui Lines: headings, emphasis, strikethrough, nested
ordered/unordered/task lists, block quotes, syntax-highlighted fenced code,
wrapped tables, links, images (alt text), footnotes, rules, and raw HTML
passthrough. Parsing stays fully in pulldown-cmark; the TUI only reacts to
parsed events for styling, so no syntax is hand-sniffed.

Unterminated fence behavior is preserved for streaming answers.
mohitranka added a commit that referenced this pull request Sep 11, 2026
The hand-rolled renderer only handled fenced code, headings, list bullets,
inline bold, and backticks — everything else (tables, links, nested lists,
quotes, italics, strikethrough) fell through as literal markup.

Replace it with a pulldown-cmark event-stream renderer that maps parsed
CommonMark onto ratatui Lines: headings, emphasis, strikethrough, nested
ordered/unordered/task lists, block quotes, syntax-highlighted fenced code,
wrapped tables, links, images (alt text), footnotes, rules, and raw HTML
passthrough. Parsing stays fully in pulldown-cmark; the TUI only reacts to
parsed events for styling, so no syntax is hand-sniffed.

Unterminated fence behavior is preserved for streaming answers.
mohitranka added a commit that referenced this pull request Sep 11, 2026
The hand-rolled renderer only handled fenced code, headings, list bullets,
inline bold, and backticks — everything else (tables, links, nested lists,
quotes, italics, strikethrough) fell through as literal markup.

Replace it with a pulldown-cmark event-stream renderer that maps parsed
CommonMark onto ratatui Lines: headings, emphasis, strikethrough, nested
ordered/unordered/task lists, block quotes, syntax-highlighted fenced code,
wrapped tables, links, images (alt text), footnotes, rules, and raw HTML
passthrough. Parsing stays fully in pulldown-cmark; the TUI only reacts to
parsed events for styling, so no syntax is hand-sniffed.

Unterminated fence behavior is preserved for streaming answers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant