Markdown: fix incorrect prettification of multi-line markdown footnote (#7203)
* fix incorrect prettification of multi-line markdown footnote * update test of footnoteDefinition * add changelog_unreleased pr-7203 * fix changelog_unreleased * fix pointed out * update snapshot test of markdown for footnote
This commit is contained in:
1 parent
ae9d2ac054
commit
3a485c68dd
3 files changed
+31
-21
No files matched your search
@@ -0,0 +1,26 @@
|
||||
#### Fix incorrect prettification of multi-line markdown footnote ([#7203](https://github.com/prettier/prettier/pull/7203) by [@sasurau4](https://github.com/sasurau4))
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```md
|
||||
<!-- Input -->
|
||||
Here's a statement[^footnote].
|
||||
|
||||
[^footnote]:
|
||||
Here's a multi-line footnote walking back the above statement, and showing
|
||||
how it's all totally bollocks.
|
||||
|
||||
<!-- Prettier stable -->
|
||||
Here's a statement[^footnote].
|
||||
|
||||
[^footnote]:
|
||||
|
||||
Here's a multi-line footnote walking back the above statement, and showing
|
||||
how it's all totally bollocks.
|
||||
|
||||
<!-- Prettier master -->
|
||||
Here's a statement[^footnote].
|
||||
|
||||
[^footnote]:
|
||||
Here's a multi-line footnote walking back the above statement, and showing
|
||||
how it's all totally bollocks.
|
||||
```
|
||||
@@ -371,12 +371,11 @@ function genericPrint(path, options, print) {
|
||||
align(
|
||||
" ".repeat(options.tabWidth),
|
||||
printChildren(path, options, print, {
|
||||
processor: (childPath, index) =>
|
||||
index === 0
|
||||
? group(
|
||||
concat([softline, softline, childPath.call(print)])
|
||||
)
|
||||
: childPath.call(print)
|
||||
processor: (childPath, index) => {
|
||||
return index === 0
|
||||
? group(concat([softline, childPath.call(print)]))
|
||||
: childPath.call(print);
|
||||
}
|
||||
})
|
||||
),
|
||||
nextNode && nextNode.type === "footnoteDefinition"
|
||||
|
||||
@@ -13,12 +13,10 @@ proseWrap: "always"
|
||||
|
||||
=====================================output=====================================
|
||||
[^hello]:
|
||||
|
||||
this is a long long long long long long long long long long long long long
|
||||
paragraph.
|
||||
|
||||
[^world]:
|
||||
|
||||
this is a long long long long long long long long long long long long long
|
||||
paragraph. this is a long long long long long long long long long long long
|
||||
long long paragraph.
|
||||
@@ -58,7 +56,6 @@ proseWrap: "preserve"
|
||||
=====================================output=====================================
|
||||
[^hello]: this is a long long long long long long long long long long long long long paragraph.
|
||||
[^world]:
|
||||
|
||||
this is a long long long long long long long long long long long long long paragraph.
|
||||
this is a long long long long long long long long long long long long long paragraph.
|
||||
|
||||
@@ -98,7 +95,6 @@ proseWrap: "always"
|
||||
|
||||
=====================================output=====================================
|
||||
[^fn1]:
|
||||
|
||||
> \`\`\`rs
|
||||
> fn main() {
|
||||
> println!("this is some Rust!");
|
||||
@@ -114,7 +110,6 @@ proseWrap: "always"
|
||||
\`\`\`
|
||||
|
||||
[^fn2]:
|
||||
|
||||
Here is a footnote which includes code. Here is a footnote which includes
|
||||
code. Here is a footnote which includes code.
|
||||
|
||||
@@ -160,7 +155,6 @@ proseWrap: "never"
|
||||
|
||||
=====================================output=====================================
|
||||
[^fn1]:
|
||||
|
||||
> \`\`\`rs
|
||||
> fn main() {
|
||||
> println!("this is some Rust!");
|
||||
@@ -176,7 +170,6 @@ proseWrap: "never"
|
||||
\`\`\`
|
||||
|
||||
[^fn2]:
|
||||
|
||||
Here is a footnote which includes code. Here is a footnote which includes code. Here is a footnote which includes code.
|
||||
|
||||
\`\`\`rs
|
||||
@@ -221,7 +214,6 @@ proseWrap: "preserve"
|
||||
|
||||
=====================================output=====================================
|
||||
[^fn1]:
|
||||
|
||||
> \`\`\`rs
|
||||
> fn main() {
|
||||
> println!("this is some Rust!");
|
||||
@@ -237,7 +229,6 @@ proseWrap: "preserve"
|
||||
\`\`\`
|
||||
|
||||
[^fn2]:
|
||||
|
||||
Here is a footnote which includes code. Here is a footnote which includes code. Here is a footnote which includes code.
|
||||
|
||||
\`\`\`rs
|
||||
@@ -297,13 +288,11 @@ proseWrap: "always"
|
||||
[^a]: a
|
||||
[^a]: a
|
||||
[^a]:
|
||||
|
||||
> 123\\
|
||||
> 456
|
||||
|
||||
[^a]: a
|
||||
[^a]:
|
||||
|
||||
> 123\\
|
||||
> 456
|
||||
|
||||
@@ -362,13 +351,11 @@ proseWrap: "never"
|
||||
[^a]: a
|
||||
[^a]: a
|
||||
[^a]:
|
||||
|
||||
> 123\\
|
||||
> 456
|
||||
|
||||
[^a]: a
|
||||
[^a]:
|
||||
|
||||
> 123\\
|
||||
> 456
|
||||
|
||||
@@ -427,13 +414,11 @@ proseWrap: "preserve"
|
||||
[^a]: a
|
||||
[^a]: a
|
||||
[^a]:
|
||||
|
||||
> 123\\
|
||||
> 456
|
||||
|
||||
[^a]: a
|
||||
[^a]:
|
||||
|
||||
> 123\\
|
||||
> 456
|
||||
|
||||
|
||||
Reference in new issue
Block a user