Skip to content

[Repo Assist] fix: Markdown.ToMd multi-paragraph blockquote round-trip#1202

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-issue-blockquote-roundtrip-2026-05-07-759bdc345217ef67
Draft

[Repo Assist] fix: Markdown.ToMd multi-paragraph blockquote round-trip#1202
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-issue-blockquote-roundtrip-2026-05-07-759bdc345217ef67

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 7, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Root Cause

Markdown.ToMd serialised a QuotedBlock by 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 separate QuotedBlock nodes rather than the original single one with multiple paragraphs.

Fix

In MarkdownUtils.fs formatParagraph:

  • Strip trailing blank lines from each paragraph's formatted lines before prefixing with "> ".
  • Emit ">" (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

File Change
src/FSharp.Formatting.Markdown/MarkdownUtils.fs Fix QuotedBlock serialisation
tests/FSharp.Markdown.Tests/Markdown.fs Two new round-trip tests
RELEASE_NOTES.md Changelog entry under [Unreleased] ### Fixed

Test Status

  • dotnet build FSharp.Formatting.sln --configuration Release0 warnings, 0 errors
  • dotnet test tests/FSharp.Markdown.Tests --configuration Release --no-build348/348 passed (includes 2 new tests)
  • dotnet fantomas ... --check — formatting verified

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@fc4ab36dedc44e2a1cdc195cecce262f06c81230

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants