chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.5.0 Latest 5 packages
Markdown's <details> opens to what it hides under its summary
MergedThis pull reads markdown's <details>/<summary> HTML blocks on the server and turns them into a new details { runs, blocks, expanded? } block. The lexicon only gains fields, and the web and iOS renderers draw the new block in the same change, as AGENTS.md asks. Each platform keeps whether a details block is open the way it already does: remembered on the web, and view.memory keyed by the block's hash on iOS, as ResolvedRichBlocks does.
I followed the reader's stack handling and found it sound:
- A details block left open closes when its quote, item, footnote or the document ends.
- A
</details>inside markdown nested in the details block (an item, say) never closes it. - Offsets in
details_tagandhtml_textstay on char boundaries, becauseget(..)is used and<,;and&are ASCII. - Text from the summary reaches the clients only as plain runs, so the change opens no HTML path.
The new test covers the main shapes, and every check passes: check, test, web, lexicons, e2e and e2e-spaces. The docs check was skipped because no docs changed. I read every changed file. I left one small comment, about blocks inside a summary being dropped. Nothing needs to change before this merges.
crates/hud-core/src/ui/document.rslines 505 to 516
Some(Open::Details { | |
in_summary: true, | |
summary, | |
.. | |
}) => { | |
if let Some(Value::Array(runs)) = b.get("runs") { | |
if !summary.is_empty() { | |
summary.push(run(" ", None)); | |
} | |
summary.extend(runs.iter().cloned()); | |
} | |
} |
Inside a summary, a block with no runs (a list, a code block, a quote, a table between <summary> and </summary>) is dropped without a trace, along with everything in it. That's rare in practice, but if you want nothing lost, fall back to its text, or push it into blocks. Optional.
A pull's body, a README or any markdown HUD draws now folds a
<details>under its<summary>, as GitHub does, so this repository's own pull template reads as written: the opener, then "Claude Opus 5.5 · high" opening to the rest.Claude Opus 5.5 · high
What changes
Server (
hud_core::ui::document): an HTML block's<details>,<summary>and their ends, any case, make a new block,details { runs, blocks, expanded? }:runsits summary,blocksthe markdown between,expandedfrom<details open>. A summary's HTML is read as text (tags left out,&,·,·and the like read); markdown between<summary>and</summary>across blank lines keeps its formatting. One left open closes where what holds it ends (a quote, an item, a footnote, the text); a stray</details>is dropped. All other HTML stays text, as before.Lexicon (
place.hud.ui):detailsamong a block's kinds, andexpanded. It only grows.Web (
web/renderer):Blocksdraws a native<details>/<summary>("Details" where it has no summary), whether it is open kept withrememberedso a tile drawn again shows it as left;MarkdownProsespaces it as the other blocks.iOS (
HUDKit):DetailsBlock, a turning chevron and the summary as one button showing or hiding its blocks, open or closed kept inview.memory.Catalog: RichText's notes name
<details>as the one HTML drawn.Why
Pulls here open with a
<details>by the template, and HUD drew its tags as text:<details> <summary>Claude Opus 5.5 · high</summary>on a line, then everything inside unfolded. Reading the tags on the server keeps the clients drawing the tree alone, as the rest of markdown's blocks.How it was checked
just checkpasses (fmt, clippy, tests, svelte-check, lint, lex). A new test,details_hide_their_markdown_under_their_summary, holds the blocks to the lexicon: a summary with entities and tags, markdown inside,<DETAILS open>with a markdown summary and loose HTML, and one left open in a quote. The gallery (just gallery), its pull's body given a details block for the look, drew it closed with "▶ Claude Opus 5.5 · high" and, clicked, open to its bold text and list. HUDKit builds for the simulator.Shortcomings
just lookpictures in light and phone dark, nor an agent's critique.<b>,<code>) is drawn as plain text, not formatted.