[BUG] AskUserQuestion preview pane renders blank when content starts with an HTML-block tag (XML / HTML / SVG / Vue SFC)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported (only adjacent/different bugs exist — see References)
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When AskUserQuestion is invoked with options that include a preview field, the right-hand preview pane renders completely blank if the preview content begins with an HTML / XML / SVG / Vue-SFC opening tag. The empty pane gives no indication that anything was supposed to be shown — the user just sees a blank panel and has to guess what they're choosing between.
The trigger is purely textual: it does not depend on the terminal (reproduced cross-platform per the closed-as-duplicate chain), and it does not depend on the amount of content (a 10-line XML reproduces it just as reliably as a 100-line one).
Reproducible Pattern (Empirically Verified)
I ran the same AskUserQuestion with 4 then 4-then-1 preview variants. Result is consistent:
| preview content begins with | Renders? |
|---|---|
| <config>... (XML) | Blank |
| <!DOCTYPE html>... (HTML) | Blank |
| <svg ...>... (SVG) | Blank |
| <template>... (Vue SFC) | Blank |
| def process_session(... (Python) | OK |
| # Heading... (Markdown) | OK |
| import { useState }... (JSX — angle brackets appear later, inside JS) | OK |
| interface SessionStore<...> (TS with generics) | OK |
| Plain prose | OK |
The breaking inputs all share one property: the first non-whitespace token is an HTML/XML tag opener. The working inputs all share the opposite property — the first line is regular code/prose, even if <...> appears later.
Workaround (Confirmed Working)
Wrapping the same content in a fenced code block fixes the rendering for every format above:
````
<config>
...
</config>
````
Same for ` `html , `svg , `vue `. Once wrapped, the pane renders normally. This is currently the only way I've found to keep markup-as-preview usable.
This is relevant to superpowers / brainstorming skill authors and anyone who calls AskUserQuestion with side-by-side previews of XML configs, SVG sketches, HTML mockups, or Vue/Svelte/Astro SFCs — until a fix ships, please pre-wrap these previews in a language-tagged fenced code block.
Root Cause Hypothesis (with evidence)
The Claude Code CLI bundles a CommonMark parser. strings on the binary (claude-code 2.1.153) surfaces a contiguous block of parser-option names:
hardSoftBreaks wikiLinks latexMath collapseWhitespace
permissiveAtxHeaders noIndentedCodeBlocks
noHtmlBlocks noHtmlSpans tagFilter
noHtmlBlocks existing as an option means HTML blocks are recognized by default. Per the CommonMark spec, §4.6 HTML blocks, a line beginning with <svg, <config, <template>, or <!DOCTYPE opens an HTML block — and the whole document up to the closing condition becomes a single raw-HTML AST node.
The terminal/Ink renderer downstream of the parser has no rule for displaying arbitrary raw HTML in a TUI, so the AST node is either passed through tagFilter-style sanitization to nothing, or simply skipped by the visitor that walks the tree. Either way: empty pane.
This neatly explains the binary outcome we observe — the bug fires iff CommonMark would have classified the first line as an HTML-block opener.
Suggested Fixes (in order of preference)
- Best — disable HTML-block parsing for AskUserQuestion previews. Previews are not a place where raw HTML should ever be honored (no browser, no XSS surface; the renderer can't render HTML anyway). Pass
noHtmlBlocks: true(or equivalent) to the parser specifically when rendering the preview pane. Markup content then renders as plain paragraphs — verbatim, readable, exactly what users want.
- Add an explicit render rule for
HtmlBlocknodes. Visit the node and print its raw source. This is the most conservative fix (no parser changes) but slightly more code: a single visitor case. Has the side benefit of also fixing the "looks like HTML but isn't valid markup" case.
- Detect the leading
<and route through a code-block code path. Heuristic. Cheapest to ship but most likely to regress something. Listed for completeness; (1) is strictly better.
The author-side workaround (wrap in fenced code block) is a band-aid — skill authors and SDK consumers shouldn't need to know about CommonMark's HTML-block rule to make their previews show up.
Steps to Reproduce
- Invoke
AskUserQuestionwith at least one option whosepreviewfield begins with<config>,<svg ...>,<template>, or<!DOCTYPE html>. Other options can be plain prose. - Observe: the affected option's preview pane is blank. Plain-prose options render normally.
- Re-invoke the same call with the markup wrapped in `
`xml(orhtml/svg/vue`). The pane now renders.
Environment
- Claude Code version: 2.1.153 (Homebrew cask
claude-code) - OS: macOS 26 (Darwin 24.6.0), arm64
- Terminal: kitty (also confirmed by cross-platform reporters in the closed-as-duplicate chain — Windows Terminal, VS Code, iTerm — so this is renderer-side, not terminal-specific)
- Claude Model: Opus 4.7 (1M context)
Is this a regression?
Unknown — the AskUserQuestion preview pane has had a chain of rendering bugs (#38674, #33062, #65894). It is plausible this has been present since the side-by-side preview was introduced and was simply masked by the other rendering issues.
References
- #38674 — preview pane truncation, repeatedly auto-closed as duplicate of unrelated iOS issue; demonstrates the "preview features get lost in dup-bot chains" pattern. Please do not auto-close this as duplicate of #38674 — it's a different rendering failure mode (blank, not truncation).
- #33062 — also about preview pane (truncation, code-block content). Closed-as-duplicate by bot.
- #65894 — open: separate preview-related bug (
n+Enter drops highlighted option). Confirms the side-by-side preview surface is brittle. - #1150 — different layer (model-side
<error>→<e>collapse on file reads), but adjacent symptom that searches surface; included for context.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗