Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vignesh07
Copy link
Contributor

Summary

Add syntax highlighting to markdown code blocks in the TUI using cli-highlight with a VS Code Dark-inspired color theme.

Features

  • 🎨 191 languages supported via highlight.js
  • 🔍 Auto-detection fallback for unknown languages
  • ✨ Graceful fallback to plain styling on errors
  • 🌙 VS Code Dark-inspired color palette

Color Scheme

Token Color Example
Keywords Purple const, function, if
Built-ins Teal console, Math, print
Strings Orange "hello"
Numbers Green 42, 3.14
Comments Green // comment
Functions Yellow greet()
Literals Blue true, false, null

Changes

  • Added cli-highlight dependency
  • Added syntaxTheme and highlightCode function to theme.ts
  • Wired up highlightCode in markdownTheme
  • Added tests for highlighting functionality

Testing

  • ✅ All 9 new tests pass
  • ✅ Lint passes
  • ✅ Tested locally in TUI with TypeScript, Python, Bash, JSON

Note

This uses the existing dark theme only. Light mode support would require a broader TUI theming feature.


🤖 AI-assisted (Claude) - fully tested locally

Add syntax highlighting to markdown code blocks in the TUI using
cli-highlight with a VS Code Dark-inspired color theme.

Features:
- 191 languages supported via highlight.js
- Auto-detection fallback for unknown languages
- Graceful fallback to plain styling on errors
- VS Code Dark-inspired color palette

Colors:
- Purple: keywords (const, function, if, etc.)
- Teal: built-ins (console, Math, print, etc.)
- Orange: strings
- Green: numbers, comments
- Yellow: function names
- Blue: literals (true, false, null)
- Red: diff deletions
- Light blue: variables, parameters

🤖 AI-assisted (Claude) - fully tested locally
@vignesh07 vignesh07 marked this pull request as draft January 19, 2026 00:37
Tests now verify structure and content preservation rather than
checking for specific ANSI escape codes, which may not be present
in CI environments without TTY/color support.
@vignesh07 vignesh07 marked this pull request as ready for review January 19, 2026 00:43
@steipete steipete merged commit 640e199 into openclaw:main Jan 19, 2026
17 of 22 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: f4de123
  • Merge commit: 640e199

Thanks @vignesh07!

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.

2 participants