Skip to content

Formatter: prefix every line of a blockquote's children with > - #640

Merged
joelzwarrington merged 1 commit into
markdoc:mainfrom
nsafai:fix-blockquote-formatting
Sep 11, 2026
Merged

joelzwarrington merged 1 commit into
markdoc:mainfrom
nsafai:fix-blockquote-formatting

Conversation

@nsafai

@nsafai nsafai commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

format() prefixes each child of a blockquote with > on its first line only, so any child spanning several lines loses the quote on the rest. The multi-line sibling of #321, which fixed the two-paragraph case.

Input:

> Intro:
>
> - One
> - Two

Output on main:

> Intro:
> 
> - One
- Two

Nested blockquotes and fenced code inside a blockquote break the same way. Found via Keystatic, which writes files with format(): saving an essay with a quoted list silently restructured it.

Fix: format the children unindented, join them with a blank line, and prefix every line with > at the blockquote's own indent, so a quote inside a list item still nests. Three tests added; all fail on main.

@cla-assistant

cla-assistant Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

The formatter prefixed each blockquote child only on its first line, so
any child spanning several lines lost the quote on the rest. A list
inside a blockquote came out as one quoted item followed by a plain
list; a nested blockquote or fenced code block broke the same way.

Prefix every line of each child instead, dropping the child's own
indent first so a blockquote inside a list item still nests correctly.

Fixes lists, nested blockquotes and code fences inside blockquotes.
@nsafai
nsafai force-pushed the fix-blockquote-formatting branch 3 times, most recently from 838f45f to 7586686 Compare September 11, 2026 04:20
@nsafai
nsafai marked this pull request as ready for review September 11, 2026 04:23

@joelzwarrington joelzwarrington left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for the contribution!

@joelzwarrington
joelzwarrington merged commit 01114f8 into markdoc:main Sep 11, 2026
3 checks passed
@nsafai

nsafai commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the contribution!

Happy to! Btw, thanks for the quick merge @joelzwarrington

Any chance this could go out in a patch release soon? Hoping to bump Keystatic's Markdoc dependency to pick it up, since its editor writes files with format().

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