[Repo Assist] fix: Markdown.ToMd multi-paragraph blockquote round-trip#1202
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Draft
Conversation
The old code emitted a bare blank line between inner paragraphs of a QuotedBlock. CommonMark closes the blockquote on a bare blank line, so re-parsing the serialised output produced multiple separate QuotedBlock nodes instead of one. Fix: strip trailing blank lines from each paragraph's formatted lines before prefixing them with '> ', and emit '>' (an empty blockquote continuation line) as the separator between paragraphs. Two new tests are added: - Round-trip preserves a multi-paragraph blockquote as a single QuotedBlock - The '>' separator lines keep the blockquote open Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Root Cause
Markdown.ToMdserialised aQuotedBlockby prefixing every inner paragraph line with"> "and then emitting a plain blank line ("") between paragraphs. A bare blank line terminates a CommonMark blockquote, so re-parsing the serialised output produced multiple separateQuotedBlocknodes rather than the original single one with multiple paragraphs.Fix
In
MarkdownUtils.fsformatParagraph:"> ".">"(an empty blockquote continuation line) as the separator between inner paragraphs instead of"".This is the minimal, well-defined fix — it follows CommonMark spec §5.1 which says a blockquote continuation line starting with
>continues the current blockquote.Changes
src/FSharp.Formatting.Markdown/MarkdownUtils.fsQuotedBlockserialisationtests/FSharp.Markdown.Tests/Markdown.fsRELEASE_NOTES.md[Unreleased] ### FixedTest Status
dotnet build FSharp.Formatting.sln --configuration Release— 0 warnings, 0 errorsdotnet test tests/FSharp.Markdown.Tests --configuration Release --no-build— 348/348 passed (includes 2 new tests)dotnet fantomas ... --check— formatting verified