Strip blockquote markers from a setext heading's continuation lines (#19878)
This commit is contained in:
1 parent
45a4a75ea6
commit
07184252aa
4 files changed
+71
-1
No files matched your search
@@ -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
|
||||
> ===
|
||||
```
|
||||
@@ -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
|
||||
> > ===
|
||||
Reference in new issue
Block a user