Skip to content

feat(markdown): render list items as nested containers#694

Draft
remorses wants to merge 5 commits intoanomalyco:mainfrom
remorses:feat/markdown-list-containers
Draft

feat(markdown): render list items as nested containers#694
remorses wants to merge 5 commits intoanomalyco:mainfrom
remorses:feat/markdown-list-containers

Conversation

@remorses
Copy link
Contributor

Split from #597 to make review easier. Depends on #692.

Replaces flat text chunk list rendering with BoxRenderable containers. Each list item gets its own box, with the first inline text on the marker line and remaining child tokens (nested lists, code blocks) as indented children. Supports nested lists, task checkboxes, and code blocks inside list items.

Morse added 4 commits February 16, 2026 14:21
…istency

Extract createBlockRenderable() as a centralized dispatch method that
maps token types to their corresponding renderables. This replaces
the scattered if/else logic in createDefaultRenderable().

Also extract getBlockMarginBottom() helper to replace repeated
ternary expressions, and fix a bug where marginBottom was not being
updated when tokens were unchanged (the fast paths in updateBlocks
for same-reference and same-raw tokens now properly set marginBottom
on the existing renderable).
When createBlockRenderable is called for nested content (e.g. inside
blockquote children), space tokens should produce a visible renderable
rather than returning null. The top-level createDefaultRenderable still
filters out space tokens for block-level rendering.
Replace flat text chunk rendering of lists with BoxRenderable containers.
Each list becomes a column box containing item boxes. The first inline
text stays on the marker line ('- Item text'), and remaining child tokens
(nested lists, code blocks) are added as children with marginLeft: 2
for visual indentation.

Supports:
- Nested unordered/ordered lists
- Task list checkboxes ([ ] and [x])
- Code blocks inside list items
- Any block content inside list items via createBlockRenderable

Removes the old renderListChunks method and adds createListRenderable.
Updates updateBlockRenderable and rerenderBlocks to handle list type
by removing and reinserting (since container structure changes).
…ndering

Add two comprehensive snapshot tests:
- llm-style response mixing quotes, nested lists, hr, and paragraphs
- complex markdown document with nested lists inside blockquotes,
  task lists, tables, code blocks, links, and multiple quote blocks

These catch regressions in the interaction between all the new
container-based rendering for lists and blockquotes.

Also fix comment wording and snapshot whitespace.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 16, 2026

@opentui/core

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core@3c31ab1

@opentui/react

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/react@3c31ab1

@opentui/solid

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/solid@3c31ab1

@opentui/core-darwin-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-arm64@3c31ab1

@opentui/core-darwin-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-x64@3c31ab1

@opentui/core-linux-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-arm64@3c31ab1

@opentui/core-linux-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-x64@3c31ab1

@opentui/core-win32-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-arm64@3c31ab1

@opentui/core-win32-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-x64@3c31ab1

commit: 3c31ab1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant