-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat(opencode): enhanced markdown renderer with tables, themes, and syntax highlighting #8077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ryanwyler
wants to merge
1
commit into
anomalyco:dev
Choose a base branch
from
gignit:feature/markdown-renderer
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,472
−15
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
21f2b08 to
fd0fd68
Compare
Contributor
Author
fd0fd68 to
143effe
Compare
…yntax highlighting Comprehensive markdown rendering overhaul for both CLI and TUI. Features: - Table rendering with box-drawing borders, word wrap, inline markdown - Theme integration: CLI and TUI use user's selected theme - Syntax highlighting via tree-sitter for 10+ languages - Unified architecture with shared rendering logic - Smart TTY detection for clean piped output - Escaped pipe support for TypeScript union types - Double-width character support (Unicode/emoji) Fixes (from peer review): - Table parsing now preserves all columns (fixed last column drop) - Conceal toggle works in markdown code blocks - Link width calculation includes full URL for proper alignment - Theme fetch wrapped in try/catch to prevent crashes Architecture: - New markdown-renderer.ts (1255 lines) - core rendering engine - New theme-loader.ts (98 lines) - theme loading and conversion - Unified TextChunk system for CLI (ANSI) and TUI (StyledText) - Hybrid TUI rendering: text via custom renderer, code via tree-sitter Changes: - packages/opencode/src/cli/markdown-renderer.ts (new) - packages/opencode/src/cli/theme-loader.ts (new) - packages/opencode/src/cli/cmd/tui/routes/session/index.tsx (+117) - packages/opencode/src/cli/cmd/run.ts (+8) - packages/opencode/src/cli/ui.ts (+5) Closes anomalyco#3845, anomalyco#7671, anomalyco#4988, anomalyco#5675
143effe to
297c82b
Compare
Contributor
Author
Evoke4350
pushed a commit
to Evoke4350/opencode
that referenced
this pull request
Jan 13, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Related Issues
Tables & Formatting:
Summary
Comprehensive markdown rendering overhaul for both CLI and TUI with proper table support, theme integration, syntax highlighting, and unified rendering architecture.
Key Features
📊 Table Rendering
🎨 Theme Support
💻 Syntax Highlighting
🎯 Advanced Formatting
strikethrough🏗️ Architecture
🔧 Smart Behavior
Technical Details
Files Changed
Key Functions
Rendering Flow
CLI:
```
User config → loadTheme() → MarkdownTheme
Markdown → renderMarkdownThemedStyled() → TextChunks
TextChunks → textChunksToAnsi() → ANSI string → stdout
```
TUI:
```
User config → Theme context → MarkdownTheme
Markdown → parseMarkdownSegments() → [text, code, text, code]
Text segments → renderMarkdownThemedStyled() → StyledText →
Code segments → tree-sitter →
```
Examples
Before/After: Tables
Before:
```
| Header | Value |
| A | B |
```
After:
```
┌────────┬───────┐
│ Header │ Value │
├────────┼───────┤
│ A │ B │
└────────┴───────┘
```
Theme Colors
All colors match user's selected theme:
Testing
✅ CLI output verified with multiple themes
✅ TUI rendering stable during streaming
✅ Tables with complex content (inline code, word wrap, unicode)
✅ Escaped pipes (\|) for union types
✅ Double-width characters (emoji, CJK)
✅ TTY detection (piped vs interactive)
✅ All 12+ built-in themes load correctly
Breaking Changes
None - backward compatible. Existing markdown rendering continues to work.
Performance
Migration Notes
No migration needed. The feature is automatically available in both CLI and TUI.
Commits
22 commits with iterative improvements: