fix: separate block markdown children#7
Merged
Conversation
There was a problem hiding this comment.
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\nbetween adjacent block-ish children only when needed. - Refactors child serialization into a dedicated
renderChildren()path and uses it throughouttoMarkdown(). - Moves/expands coverage into a new
render-spacing.test.tsxsuite for “sticky” spacing cases and removes the superseded spacing test fromrender.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/react/render-spacing.test.tsxcoverage for sticky child-boundary cases.Validation
pnpm installpnpm exec biome check .pnpm testpnpm build