Skip to content

fix(core/markdown): compact tight nested lists#1109

Open
kitlangton wants to merge 3 commits into
anomalyco:mainfrom
kitlangton:fix/markdown-tight-nested-list-spacing
Open

fix(core/markdown): compact tight nested lists#1109
kitlangton wants to merge 3 commits into
anomalyco:mainfrom
kitlangton:fix/markdown-tight-nested-list-spacing

Conversation

@kitlangton
Copy link
Copy Markdown
Collaborator

@kitlangton kitlangton commented May 26, 2026

Summary

  • Add a regression covering tight multi-level nested lists rendered with the OpenCode internalBlockMode: "top-level" and streaming: true configuration.
  • Normalize trailing newlines for tight-list text children as well as loose-list paragraph children.
  • Inline the now-unnecessary list-child wrapper once both token shapes share the same normalization.

Why #1094 Did Not Cover This

#1094 fixed the blank-row symptom for a loose nested list whose source contains a blank line before its child list. Marked represents that parent content as a paragraph token.

This reproducer uses a tight nested list with no source blank line. Marked represents the same parent-content position as a text token. The existing normalization applied only to paragraph, leaving the trailing newline on text and producing an empty rendered row before each nested list.

Before

- Main section:

  - Supporting point:

    - Third-level detail
    - Another detail with emphasis
  - Another supporting point:

    1. First numbered item
    2. Second numbered item:

       - Nested bullet beneath a numbered item
- Second section:

  - Short detail
  - Lead-in item:

    - Explanation below the lead-in

After

- Main section:
  - Supporting point:
    - Third-level detail
    - Another detail with emphasis
  - Another supporting point:
    1. First numbered item
    2. Second numbered item:
       - Nested bullet beneath a numbered item
- Second section:
  - Short detail
  - Lead-in item:
    - Explanation below the lead-in

R/G/R Verification

  • RED commit 2b03ee50 adds only the regression test; against v0.2.15 it fails with six inserted blank rows matching the Before output.
  • GREEN commit 3833b39d applies the minimal normalization fix.
  • REFACTOR commit fec798d4 removes getListChildMarkdownRaw, which no longer carries distinct behavior after both textual child token shapes normalize identically.
  • bun test src/renderables/__tests__/Markdown.test.ts on the runnable v0.2.15 worktree: 138 pass, 0 fail.
  • bun run fmt:check packages/core/src/renderables/Markdown.ts packages/core/src/renderables/__tests__/Markdown.test.ts passes.

The v0.2.15 validation seam is intentional: it is the shipped OpenTUI version currently consumed by OpenCode. Current main has an unreleased native ABI change (getRenderStats) that prevents running the TypeScript renderer suite against the published 0.2.15 dylib in a clean worktree.

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