Bug
Fenced code blocks using common language aliases like ```sh, ```yml, ```py, ```jsonc render as pure white text (#ffffff), making them illegible.
Root Cause
Two issues combine to produce this:
1. Missing language alias mappings in parsers-config.ts
The bash parser is registered as "bash", but when markdown content uses ```sh, the system looks for a parser named "sh" — which doesn't exist. Same for yml (registered as yaml), py (registered as python), and jsonc (registered as json).
The built-in infoStringMap in @opentui/core only maps js→javascript, ts→typescript, md→markdown. There are no aliases for sh→bash, yml→yaml, py→python, etc.
2. Hardcoded white fallback in @opentui/core
When the parser lookup fails, CodeRenderable falls back to plain text rendering using _defaultFg = RGBA(1, 1, 1, 1) (pure white #ffffff). The MarkdownRenderable.createCodeRenderable method does not pass a fg prop, so the theme's text color is never used as a fallback.
This only affects the <markdown> rendering path (experimental markdown / OPENCODE_EXPERIMENTAL_MARKDOWN). The <code filetype="markdown"> path is not affected because it uses tree-sitter's markup.raw.block scope.
Suggested Fix
Quick fix (opencode side): Add parser aliases in parsers-config.ts
Register duplicate entries pointing to the same wasm/queries:
| Alias |
Points to |
Rationale |
sh |
bash |
Most common shell alias |
shell |
bash |
Common alias |
zsh |
bash |
Close enough for highlighting |
py |
python |
Common shorthand |
jsonc |
json |
Used in many config files |
yml |
yaml |
Very common alias |
Proper fix (opentui side): Two changes
-
Pass theme foreground to child code renderables — In MarkdownRenderable.createCodeRenderable, pass the default syntax style foreground as the fg option so the fallback is theme.text instead of hardcoded white.
-
Expand infoStringMap — Add common language aliases so the parser lookup succeeds for standard markdown code fence tags.
Reproduction
- Use any theme (solarized, opencode, gruvbox, etc.)
- Have the assistant respond with a
```sh fenced code block
- The code block content renders as white text
Environment
- OpenCode v1.2.10
- WSL2 (Ubuntu) with Windows Terminal
- Any theme — the white fallback bypasses all theme colors
Bug
Fenced code blocks using common language aliases like
```sh,```yml,```py,```jsoncrender as pure white text (#ffffff), making them illegible.Root Cause
Two issues combine to produce this:
1. Missing language alias mappings in
parsers-config.tsThe bash parser is registered as
"bash", but when markdown content uses```sh, the system looks for a parser named"sh"— which doesn't exist. Same foryml(registered asyaml),py(registered aspython), andjsonc(registered asjson).The built-in
infoStringMapin@opentui/coreonly mapsjs→javascript,ts→typescript,md→markdown. There are no aliases forsh→bash,yml→yaml,py→python, etc.2. Hardcoded white fallback in
@opentui/coreWhen the parser lookup fails,
CodeRenderablefalls back to plain text rendering using_defaultFg = RGBA(1, 1, 1, 1)(pure white #ffffff). TheMarkdownRenderable.createCodeRenderablemethod does not pass afgprop, so the theme's text color is never used as a fallback.This only affects the
<markdown>rendering path (experimental markdown /OPENCODE_EXPERIMENTAL_MARKDOWN). The<code filetype="markdown">path is not affected because it uses tree-sitter'smarkup.raw.blockscope.Suggested Fix
Quick fix (opencode side): Add parser aliases in
parsers-config.tsRegister duplicate entries pointing to the same wasm/queries:
shshellzshpyjsoncymlProper fix (opentui side): Two changes
Pass theme foreground to child code renderables — In
MarkdownRenderable.createCodeRenderable, pass thedefaultsyntax style foreground as thefgoption so the fallback istheme.textinstead of hardcoded white.Expand
infoStringMap— Add common language aliases so the parser lookup succeeds for standard markdown code fence tags.Reproduction
```shfenced code blockEnvironment