Strip blockquote markers from a setext heading's continuation lines (#19878)

This commit is contained in:
Miodrag Obradovic authored and GitHub committed 2026-08-18 20:35:00 +08:00
1 parent 45a4a75ea6
commit 07184252aa
4 files changed
+71 -1

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
#### Strip blockquote markers from a setext heading's continuation lines (#19878 by @Kjubikstronk)
A setext heading spanning multiple lines inside a blockquote kept the `>` marker of its continuation lines as literal text.
<!-- prettier-ignore -->
```md
<!-- Input -->
> Multi
> Line
> ===
<!-- Prettier stable -->
> Multi > Line
> ===
<!-- Prettier main -->
> Multi
> Line
> ===
```
+4 -1
View File
@@ -183,8 +183,11 @@ function splitTextIntoSentences(ast) {
// Using `node.value`, we don't need to care about markers like `\n > ` in `blockquote`s.
let text = node.raw;
// A setext heading's text can span multiple raw source lines too, e.g.
// `> Title\n> continued\n> ===`.
const paragraphIndex = parentStack.findIndex(
(ancestor) => ancestor?.type === "paragraph",
(ancestor) =>
ancestor?.type === "paragraph" || ancestor?.type === "heading",
);
const paragraphNode =
@@ -1,5 +1,40 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`blockquote.md format 1`] = `
====================================options=====================================
parsers: ["markdown"]
printWidth: 80 (default) |
=====================================input======================================
> Multi
> Line
> ===
> Multi
> Line
> Three
> ---
> > Multi
> > Line
> > ===
=====================================output=====================================
> Multi
> Line
> ===
> Multi
> Line
> Three
> ---
> > Multi
> > Line
> > ===
================================================================================
`;
exports[`child.md format 1`] = `
====================================options=====================================
parsers: ["markdown"]
@@ -0,0 +1,12 @@
> Multi
> Line
> ===
> Multi
> Line
> Three
> ---
> > Multi
> > Line
> > ===