-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Feature]: Add syntax highlighting for code blocks in WebChat #10029
Copy link
Copy link
Closed
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestNew feature or requestissue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.enhancementNew feature or requestNew feature or requestissue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
When sharing code snippets in OpenClaw's WebChat interface, code blocks appear as plain monospace text without any syntax highlighting. This makes it difficult to quickly read and understand code structure, especially for languages like C++ with complex syntax. Other platforms (Discord, GitHub, etc.) automatically highlight code, so this feels like a missing quality-of-life feature.
Proposed solution
Integrate a syntax highlighting library (like
highlight.js) into the WebChat UI's Markdown renderer. Specifically:highlight.jsas a dependency in/opt/openclaw/ui/package.json/opt/openclaw/ui/src/ui/markdown.tsto enable syntax highlighting:This would automatically highlight code blocks based on the specified language (e.g., ```cpp) or auto-detect the language when not specified.
Alternatives considered
highlight.jshas better auto-detection and is lighter weightAdditional context
/opt/openclaw/ui/src/ui/markdown.ts(current Markdown renderer)std::vector<int> nums;appears in plain black/white text