[PR #11101] fix(tui): preserve markdown headers in TUI output #13658

Closed
opened 2026-02-16 18:18:29 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11101

State: closed
Merged: No


Summary

The TUI was using the @opentui/core library's <code filetype="markdown"> component which strips markdown header symbols (#, ##, ###) while preserving other markdown formatting like bold, italic, lists, and code blocks.

This fix makes the <markdown> component the default renderer, which properly preserves markdown headers.

Changes

  • ReasoningPart: Now uses <markdown> component instead of <code filetype="markdown">
  • TextPart: Swapped default to <markdown>, legacy <code filetype="markdown"> is now behind the OPENCODE_EXPERIMENTAL_MARKDOWN flag
  • Documentation: Updated to reflect the new flag behavior - OPENCODE_EXPERIMENTAL_MARKDOWN=true now uses the legacy renderer (which strips headers)

Root Cause

The @opentui/core library's markdown parser in the <code filetype="markdown"> component was stripping header symbols while preserving other markdown formatting. This explains why:

  • Headers worked when writing to files (different rendering path)
  • Headers were stripped in terminal output (used <code filetype="markdown">)
  • Other markdown formatting was preserved

Backwards Compatibility

Users who need the old behavior can set OPENCODE_EXPERIMENTAL_MARKDOWN=true to use the legacy renderer.

Related Issues

Fixes #11048

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11101 **State:** closed **Merged:** No --- ## Summary The TUI was using the `@opentui/core` library's `<code filetype="markdown">` component which strips markdown header symbols (`#`, `##`, `###`) while preserving other markdown formatting like bold, italic, lists, and code blocks. This fix makes the `<markdown>` component the default renderer, which properly preserves markdown headers. ## Changes - **ReasoningPart**: Now uses `<markdown>` component instead of `<code filetype="markdown">` - **TextPart**: Swapped default to `<markdown>`, legacy `<code filetype="markdown">` is now behind the `OPENCODE_EXPERIMENTAL_MARKDOWN` flag - **Documentation**: Updated to reflect the new flag behavior - `OPENCODE_EXPERIMENTAL_MARKDOWN=true` now uses the legacy renderer (which strips headers) ## Root Cause The `@opentui/core` library's markdown parser in the `<code filetype="markdown">` component was stripping header symbols while preserving other markdown formatting. This explains why: - Headers worked when writing to files (different rendering path) - Headers were stripped in terminal output (used `<code filetype="markdown">`) - Other markdown formatting was preserved ## Backwards Compatibility Users who need the old behavior can set `OPENCODE_EXPERIMENTAL_MARKDOWN=true` to use the legacy renderer. ## Related Issues Fixes #11048 🤖 Generated with [Claude Code](https://claude.com/claude-code)
yindo added the pull-request label 2026-02-16 18:18:29 -05:00
yindo closed this issue 2026-02-16 18:18:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13658