Skip to content

fix: separate block markdown children#7

Merged
SoonIter merged 1 commit into
v18from
adjust-children-markdown-spacing-v18
May 22, 2026
Merged

fix: separate block markdown children#7
SoonIter merged 1 commit into
v18from
adjust-children-markdown-spacing-v18

Conversation

@SoonIter
Copy link
Copy Markdown
Owner

Summary

  • Backport block/transparent-wrapper child boundary spacing to the v18 branch.
  • Keep inline siblings, punctuation, raw Markdown text nodes, and fenced code content unchanged.
  • Add dedicated src/react/render-spacing.test.tsx coverage for sticky child-boundary cases.
  • Treat only existing blank-line boundaries as already separated.

Validation

  • pnpm install
  • pnpm exec biome check .
  • pnpm test
  • pnpm build
  • 2000 transparent block sibling smoke via built output: 19ms

Copilot AI review requested due to automatic review settings May 21, 2026 11:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the React-to-Markdown serializer to insert appropriate blank-line spacing at child boundaries for top-level / “transparent” block containers (e.g. div, section, main), bringing block sibling output in line with expected Markdown paragraph separation while preserving inline concatenation and fenced-code behavior.

Changes:

  • Introduces block-boundary detection and a separator algorithm to insert \n / \n\n between adjacent block-ish children only when needed.
  • Refactors child serialization into a dedicated renderChildren() path and uses it throughout toMarkdown().
  • Moves/expands coverage into a new render-spacing.test.tsx suite for “sticky” spacing cases and removes the superseded spacing test from render.test.tsx.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/react/render.ts Adds flow-container/block-boundary separation logic and routes child rendering through renderChildren() to enforce consistent spacing rules.
src/react/render.test.tsx Removes an outdated two-row spacing test now covered more comprehensively elsewhere.
src/react/render-spacing.test.tsx Adds focused tests covering transparent wrapper boundaries, newline completion, inline punctuation stability, and fenced-code/raw-text invariants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SoonIter SoonIter merged commit ea6020d into v18 May 22, 2026
5 checks passed
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.

2 participants