Fix incorrect wrap in sentence with linkReference (#16546)
This commit is contained in:
1 parent
139e8de3c4
commit
e977d65b19
4 files changed
+57
-2
No files matched your search
@@ -0,0 +1,16 @@
|
|||||||
|
#### Fix incorrect wrap in sentence with linkReference (#16546 by @seiyab)
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
```md
|
||||||
|
<!-- Input (--prose-wrap=always) -->
|
||||||
|
This folder has [VHS] tape files to create gifs for the [Widget Showcase]. To run them, install VHS from main (the theme and screenshot commands are not yet released).
|
||||||
|
|
||||||
|
<!-- Prettier stable -->
|
||||||
|
This folder has [VHS] tape files to create gifs for the [Widget Showcase]. To run
|
||||||
|
them, install VHS from main (the theme and screenshot commands are not yet released).
|
||||||
|
|
||||||
|
<!-- Prettier main -->
|
||||||
|
This folder has [VHS] tape files to create gifs for the [Widget Showcase]. To
|
||||||
|
run them, install VHS from main (the theme and screenshot commands are not yet
|
||||||
|
released).
|
||||||
|
```
|
||||||
@@ -48,7 +48,12 @@ function genericPrint(path, options, print) {
|
|||||||
const { node } = path;
|
const { node } = path;
|
||||||
|
|
||||||
if (shouldRemainTheSameContent(path)) {
|
if (shouldRemainTheSameContent(path)) {
|
||||||
/** @type {Doc} */
|
/*
|
||||||
|
* We assume parts always meet following conditions:
|
||||||
|
* - parts.length is odd
|
||||||
|
* - odd (0-indexed) elements are line-like doc
|
||||||
|
*/
|
||||||
|
/** @type {Doc[]} */
|
||||||
const parts = [""];
|
const parts = [""];
|
||||||
const textsNodes = splitText(
|
const textsNodes = splitText(
|
||||||
options.originalText.slice(
|
options.originalText.slice(
|
||||||
@@ -66,7 +71,8 @@ function genericPrint(path, options, print) {
|
|||||||
parts.push([parts.pop(), doc]);
|
parts.push([parts.pop(), doc]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
parts.push(doc);
|
// In this path, doc is line. To meet the condition, we need additional element "".
|
||||||
|
parts.push(doc, "");
|
||||||
}
|
}
|
||||||
return fill(parts);
|
return fill(parts);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,3 +349,35 @@ proseWrap: "never"
|
|||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`wrap.md - {"proseWrap":"always"} format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["markdown"]
|
||||||
|
printWidth: 80
|
||||||
|
proseWrap: "always"
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
This folder has [VHS] tape files to create gifs for the [Widget Showcase]. To run them, install VHS from main (the theme and screenshot commands are not yet released).
|
||||||
|
|
||||||
|
=====================================output=====================================
|
||||||
|
This folder has [VHS] tape files to create gifs for the [Widget Showcase]. To
|
||||||
|
run them, install VHS from main (the theme and screenshot commands are not yet
|
||||||
|
released).
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`wrap.md - {"proseWrap":"never"} format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["markdown"]
|
||||||
|
printWidth: 80
|
||||||
|
proseWrap: "never"
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
This folder has [VHS] tape files to create gifs for the [Widget Showcase]. To run them, install VHS from main (the theme and screenshot commands are not yet released).
|
||||||
|
|
||||||
|
=====================================output=====================================
|
||||||
|
This folder has [VHS] tape files to create gifs for the [Widget Showcase]. To run them, install VHS from main (the theme and screenshot commands are not yet released).
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
`;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This folder has [VHS] tape files to create gifs for the [Widget Showcase]. To run them, install VHS from main (the theme and screenshot commands are not yet released).
|
||||||
Reference in new issue
Block a user