Skip to content

V0.5+: custom BlockquoteSegment — recursive ChunkedMarkdown in an owned quote container #21

Description

@yyq1025

Current behavior

The chunked transcript renderer breaks code out of enriched at two levels:

  • top-level fenced/indented code → native CodeBlockSegment (shiki highlight, horizontal scroll, themed container)
  • code nested in list items → hoisted out via the list-raw line scanner (works around enriched #243, which repeats the list marker on every code line)

Blockquotes are the remaining gap: a fenced block inside a quote stays in the enriched run. It renders correctly (no upstream bug — #243 is list-marker-specific), but inconsistently with every other code block: monochrome (no shiki), no horizontal scroll, enriched's own code container.

Hoisting code OUT of blockquotes was considered and rejected: the quote bar would visually break around the hoisted block (one quote becomes two fragments sandwiching a full-width code block). Unlike ordered lists there is no numbering-continuation mechanism to make the split read naturally.

Plan

Own the blockquote container and recurse:

  1. Chunker: top-level blockquote token → new segment kind carrying marked's token.text (the dequoted inner markdown — verified it preserves fences/tables/nested quotes verbatim).
  2. Renderer: BlockquoteSegment = left-bar container (borderLeftWidth + blockquoteBorder palette color + padding) wrapping a recursive <ChunkedMarkdown markdown={inner}>. Recursion gives quotes everything for free: fence breakout (shiki inside quotes), list hoist, nested quotes.
  3. Streaming: mirror the code-segment tail logic — when the last top-level segment is a blockquote and the message is still streaming, thread streamDone=false into the inner instance so its own tail run does remend.

Open design choice

enriched currently renders quote text muted. Either thread a muted style variant through ChatMarkdown (~20 LOC), or take the opportunity to switch to normal-color text + bar (GitHub / claude.ai style) and skip the variant.

Costs

  • Cross-segment selection breaks at quote boundaries (quotes are usually short).
  • One nested ChunkedMarkdown instance per quote (low-frequency element; negligible).

Estimated ~70 LOC / half a day, most of it streaming-behavior verification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions