From 074aaedbb052a288e89d15eb0a4214de37a08866 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 15 Apr 2026 09:17:38 +0800 Subject: [PATCH 1/5] Replace `main` branch in changelog link with tags (#19054) --- .../release/steps/show-instructions-after-npm-publish.js | 9 +++------ scripts/release/tests/publish-to-npm.test.js | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/release/steps/show-instructions-after-npm-publish.js b/scripts/release/steps/show-instructions-after-npm-publish.js index d5663095f..a90f54fef 100644 --- a/scripts/release/steps/show-instructions-after-npm-publish.js +++ b/scripts/release/steps/show-instructions-after-npm-publish.js @@ -11,10 +11,11 @@ const RELEASE_URL_BASE = "https://github.com/prettier/prettier/releases/new?"; export function getReleaseUrl(version, previousVersion) { const semverDiff = semver.diff(version, previousVersion); const isPatch = semverDiff === "patch"; + const tag = version; let body; if (isPatch) { const urlToChangelog = - "https://github.com/prettier/prettier/blob/main/CHANGELOG.md#" + + `https://github.com/prettier/prettier/blob/${tag}/CHANGELOG.md#` + version.split(".").join(""); body = `🔗 [Changelog](${urlToChangelog})`; } else { @@ -25,11 +26,7 @@ export function getReleaseUrl(version, previousVersion) { body: `🔗 [Release note](https://prettier.io/${blogPostInfo.path})`, }); } - const parameters = new URLSearchParams({ - tag: version, - title: version, - body, - }); + const parameters = new URLSearchParams({ tag, title: version, body }); return `${RELEASE_URL_BASE}${parameters}`; } diff --git a/scripts/release/tests/publish-to-npm.test.js b/scripts/release/tests/publish-to-npm.test.js index 6f03106ce..b3260e268 100644 --- a/scripts/release/tests/publish-to-npm.test.js +++ b/scripts/release/tests/publish-to-npm.test.js @@ -24,7 +24,7 @@ describe("publish-to-npm", () => { getExpectedReleaseUrl({ tag: "2.3.1", title: "2.3.1", - body: "🔗 [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#231)", + body: "🔗 [Changelog](https://github.com/prettier/prettier/blob/2.3.1/CHANGELOG.md#231)", }), ); }); From 4a673dc9b59ddf7296bbab9822093d2971da84a8 Mon Sep 17 00:00:00 2001 From: "byplayer(Andy)" Date: Thu, 4 Jun 2026 19:21:03 +0900 Subject: [PATCH 2/5] Fix blank lines between list items and nested sub-lists being removed in Markdown/MDX (#17857) Co-authored-by: Tatsunori Uchino Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: fisker Cheung --- changelog_unreleased/markdown/17746.md | 31 + src/language-markdown/print/children.js | 5 +- .../list/__snapshots__/format.test.js.snap | 539 ++++++++++++++++++ .../list/issue-17746-code-before-list.md | 4 + .../issue-17746-code-sibling-nested-list.md | 7 + ...ssue-17746-fenced-code-then-nested-list.md | 6 + ...ue-17746-indented-code-then-nested-list.md | 3 + tests/format/markdown/list/issue-17746.md | 8 + .../spec/__snapshots__/format.test.js.snap | 2 + .../mdx/mdx/__snapshots__/format.test.js.snap | 178 ++++++ .../mdx/mdx/issue-17746-code-before-list.mdx | 4 + ...sue-17746-fenced-code-then-nested-list.mdx | 5 + ...e-17746-indented-code-then-nested-list.mdx | 3 + tests/format/mdx/mdx/issue-17746.mdx | 8 + 14 files changed, 802 insertions(+), 1 deletion(-) create mode 100644 changelog_unreleased/markdown/17746.md create mode 100644 tests/format/markdown/list/issue-17746-code-before-list.md create mode 100644 tests/format/markdown/list/issue-17746-code-sibling-nested-list.md create mode 100644 tests/format/markdown/list/issue-17746-fenced-code-then-nested-list.md create mode 100644 tests/format/markdown/list/issue-17746-indented-code-then-nested-list.md create mode 100644 tests/format/markdown/list/issue-17746.md create mode 100644 tests/format/mdx/mdx/issue-17746-code-before-list.mdx create mode 100644 tests/format/mdx/mdx/issue-17746-fenced-code-then-nested-list.mdx create mode 100644 tests/format/mdx/mdx/issue-17746-indented-code-then-nested-list.mdx create mode 100644 tests/format/mdx/mdx/issue-17746.mdx diff --git a/changelog_unreleased/markdown/17746.md b/changelog_unreleased/markdown/17746.md new file mode 100644 index 000000000..aa7516d72 --- /dev/null +++ b/changelog_unreleased/markdown/17746.md @@ -0,0 +1,31 @@ +#### Fix blank lines between list items and nested sub-lists being removed in Markdown/MDX (#17746 by @byplayer) + +Prettier was removing blank lines between list items and their nested sub-lists, converting loose lists into tight lists and changing their semantic meaning. + + +```markdown + +- a + + - b + +- c + + + - d + + +- a + - b +- c + - d + + +- a + + - b + +- c + + - d +``` diff --git a/src/language-markdown/print/children.js b/src/language-markdown/print/children.js index daaa5e0a3..e9084f100 100644 --- a/src/language-markdown/print/children.js +++ b/src/language-markdown/print/children.js @@ -63,7 +63,10 @@ function shouldPrePrintDoubleHardline({ node, previous, parent }, options) { isLooseListItem(previous, options) || (node.type === "list" && parent.type === "listItem" && - previous.type === "code") + (previous.type === "code" || + // Preserve blank line before nested list within listItem (issue #17746) + previous.type === "paragraph") && + previous.position.end.line + 1 < node.position.start.line) ) { return true; } diff --git a/tests/format/markdown/list/__snapshots__/format.test.js.snap b/tests/format/markdown/list/__snapshots__/format.test.js.snap index 777295a4e..7e0b8d334 100644 --- a/tests/format/markdown/list/__snapshots__/format.test.js.snap +++ b/tests/format/markdown/list/__snapshots__/format.test.js.snap @@ -1232,6 +1232,7 @@ tabWidth: 0 =====================================output===================================== - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1270,6 +1271,7 @@ tabWidth: 0 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1311,6 +1313,7 @@ tabWidth: 0 b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1447,6 +1450,7 @@ tabWidth: 4 =====================================output===================================== - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1485,6 +1489,7 @@ tabWidth: 4 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1526,6 +1531,7 @@ tabWidth: 4 b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1662,6 +1668,7 @@ tabWidth: 999 =====================================output===================================== - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1700,6 +1707,7 @@ tabWidth: 999 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1741,6 +1749,7 @@ tabWidth: 999 b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1876,6 +1885,7 @@ proseWrap: "always" =====================================output===================================== - [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1914,6 +1924,7 @@ proseWrap: "always" 1. [ ] a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -1955,6 +1966,7 @@ proseWrap: "always" b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b + - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a @@ -2339,6 +2351,7 @@ tabWidth: 0 2. List 1. Some text, and code block below, with newline after code block + 1. Another 2. List @@ -2397,6 +2410,7 @@ tabWidth: 4 2. List 1. Some text, and code block below, with newline after code block + 1. Another 2. List @@ -2455,6 +2469,7 @@ tabWidth: 999 2. List 1. Some text, and code block below, with newline after code block + 1. Another 2. List @@ -2512,6 +2527,7 @@ proseWrap: "always" 2. List 1. Some text, and code block below, with newline after code block + 1. Another 2. List @@ -2526,6 +2542,505 @@ proseWrap: "always" ================================================================================ `; +exports[`issue-17746.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 0 + | printWidth +=====================================input====================================== +- a + + - b + +- c + + + - d + +=====================================output===================================== +- a + + - b + +- c + + - d + +================================================================================ +`; + +exports[`issue-17746.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 4 + | printWidth +=====================================input====================================== +- a + + - b + +- c + + + - d + +=====================================output===================================== +- a + + - b + +- c + + - d + +================================================================================ +`; + +exports[`issue-17746.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 999 + | printWidth +=====================================input====================================== +- a + + - b + +- c + + + - d + +=====================================output===================================== +- a + + - b + +- c + + - d + +================================================================================ +`; + +exports[`issue-17746.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +- a + + - b + +- c + + + - d + +=====================================output===================================== +- a + + - b + +- c + + - d + +================================================================================ +`; + +exports[`issue-17746-code-before-list.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 0 + | printWidth +=====================================input====================================== +- a + - b +- c +- d + +=====================================output===================================== +- a + - b +- c +- d + +================================================================================ +`; + +exports[`issue-17746-code-before-list.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 4 + | printWidth +=====================================input====================================== +- a + - b +- c +- d + +=====================================output===================================== +- a + - b +- c +- d + +================================================================================ +`; + +exports[`issue-17746-code-before-list.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 999 + | printWidth +=====================================input====================================== +- a + - b +- c +- d + +=====================================output===================================== +- a + - b +- c +- d + +================================================================================ +`; + +exports[`issue-17746-code-before-list.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +- a + - b +- c +- d + +=====================================output===================================== +- a + - b +- c +- d + +================================================================================ +`; + +exports[`issue-17746-code-sibling-nested-list.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 0 + | printWidth +=====================================input====================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +=====================================output===================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +================================================================================ +`; + +exports[`issue-17746-code-sibling-nested-list.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 4 + | printWidth +=====================================input====================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +=====================================output===================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +================================================================================ +`; + +exports[`issue-17746-code-sibling-nested-list.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 999 + | printWidth +=====================================input====================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +=====================================output===================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +================================================================================ +`; + +exports[`issue-17746-code-sibling-nested-list.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +=====================================output===================================== +- a + \`\`\` + b + \`\`\` +- c + + - d + +================================================================================ +`; + +exports[`issue-17746-fenced-code-then-nested-list.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 0 + | printWidth +=====================================input====================================== +- \`\`\` + a + \`\`\` + + - b +- c + +=====================================output===================================== +- \`\`\` + a + \`\`\` + + - b + +- c + +================================================================================ +`; + +exports[`issue-17746-fenced-code-then-nested-list.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 4 + | printWidth +=====================================input====================================== +- \`\`\` + a + \`\`\` + + - b +- c + +=====================================output===================================== +- \`\`\` + a + \`\`\` + + - b + +- c + +================================================================================ +`; + +exports[`issue-17746-fenced-code-then-nested-list.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 999 + | printWidth +=====================================input====================================== +- \`\`\` + a + \`\`\` + + - b +- c + +=====================================output===================================== +- \`\`\` + a + \`\`\` + + - b + +- c + +================================================================================ +`; + +exports[`issue-17746-fenced-code-then-nested-list.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +- \`\`\` + a + \`\`\` + + - b +- c + +=====================================output===================================== +- \`\`\` + a + \`\`\` + + - b + +- c + +================================================================================ +`; + +exports[`issue-17746-indented-code-then-nested-list.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 0 + | printWidth +=====================================input====================================== +- a + + - b + +=====================================output===================================== +- a + + - b + +================================================================================ +`; + +exports[`issue-17746-indented-code-then-nested-list.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 4 + | printWidth +=====================================input====================================== +- a + + - b + +=====================================output===================================== +- a + + - b + +================================================================================ +`; + +exports[`issue-17746-indented-code-then-nested-list.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 999 + | printWidth +=====================================input====================================== +- a + + - b + +=====================================output===================================== +- a + + - b + +================================================================================ +`; + +exports[`issue-17746-indented-code-then-nested-list.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +- a + + - b + +=====================================output===================================== +- a + + - b + +================================================================================ +`; + exports[`long-paragraph.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` ====================================options===================================== parsers: ["markdown"] @@ -2615,12 +3130,15 @@ tabWidth: 0 =====================================output===================================== - 123 + - abc - 456 + - def - 789 + - ghi ================================================================================ @@ -2648,12 +3166,15 @@ tabWidth: 4 =====================================output===================================== - 123 + - abc - 456 + - def - 789 + - ghi ================================================================================ @@ -2681,12 +3202,15 @@ tabWidth: 999 =====================================output===================================== - 123 + - abc - 456 + - def - 789 + - ghi ================================================================================ @@ -2713,12 +3237,15 @@ proseWrap: "always" =====================================output===================================== - 123 + - abc - 456 + - def - 789 + - ghi ================================================================================ @@ -2897,6 +3424,7 @@ tabWidth: 0 =====================================output===================================== - parent list item parent list item parent list item parent list item parent list item parent list item + - child list item child list item child list item child list item child list item child list item @@ -2905,6 +3433,7 @@ tabWidth: 0 - [x] parent task list item parent task list item parent task list item parent task list item + - [x] child task list item child task list item child task list item child task list item @@ -2937,6 +3466,7 @@ tabWidth: 4 =====================================output===================================== - parent list item parent list item parent list item parent list item parent list item parent list item + - child list item child list item child list item child list item child list item child list item @@ -2945,6 +3475,7 @@ tabWidth: 4 - [x] parent task list item parent task list item parent task list item parent task list item + - [x] child task list item child task list item child task list item child task list item @@ -2977,6 +3508,7 @@ tabWidth: 999 =====================================output===================================== - parent list item parent list item parent list item parent list item parent list item parent list item + - child list item child list item child list item child list item child list item child list item @@ -2985,6 +3517,7 @@ tabWidth: 999 - [x] parent task list item parent task list item parent task list item parent task list item + - [x] child task list item child task list item child task list item child task list item @@ -3016,6 +3549,7 @@ proseWrap: "always" =====================================output===================================== - parent list item parent list item parent list item parent list item parent list item parent list item + - child list item child list item child list item child list item child list item child list item @@ -3024,6 +3558,7 @@ proseWrap: "always" - [x] parent task list item parent task list item parent task list item parent task list item + - [x] child task list item child task list item child task list item child task list item @@ -4390,6 +4925,7 @@ tabWidth: 0 [title](link) - Text + - foo - foo - bar @@ -4449,6 +4985,7 @@ tabWidth: 4 [title](link) - Text + - foo - foo - bar @@ -4508,6 +5045,7 @@ tabWidth: 999 [title](link) - Text + - foo - foo - bar @@ -4566,6 +5104,7 @@ proseWrap: "always" [title](link) - Text + - foo - foo - bar diff --git a/tests/format/markdown/list/issue-17746-code-before-list.md b/tests/format/markdown/list/issue-17746-code-before-list.md new file mode 100644 index 000000000..58d20f0b6 --- /dev/null +++ b/tests/format/markdown/list/issue-17746-code-before-list.md @@ -0,0 +1,4 @@ +- a + - b +- c +- d diff --git a/tests/format/markdown/list/issue-17746-code-sibling-nested-list.md b/tests/format/markdown/list/issue-17746-code-sibling-nested-list.md new file mode 100644 index 000000000..fd53cf74d --- /dev/null +++ b/tests/format/markdown/list/issue-17746-code-sibling-nested-list.md @@ -0,0 +1,7 @@ +- a + ``` + b + ``` +- c + + - d diff --git a/tests/format/markdown/list/issue-17746-fenced-code-then-nested-list.md b/tests/format/markdown/list/issue-17746-fenced-code-then-nested-list.md new file mode 100644 index 000000000..39f855c1c --- /dev/null +++ b/tests/format/markdown/list/issue-17746-fenced-code-then-nested-list.md @@ -0,0 +1,6 @@ +- ``` + a + ``` + + - b +- c diff --git a/tests/format/markdown/list/issue-17746-indented-code-then-nested-list.md b/tests/format/markdown/list/issue-17746-indented-code-then-nested-list.md new file mode 100644 index 000000000..d74648228 --- /dev/null +++ b/tests/format/markdown/list/issue-17746-indented-code-then-nested-list.md @@ -0,0 +1,3 @@ +- a + + - b diff --git a/tests/format/markdown/list/issue-17746.md b/tests/format/markdown/list/issue-17746.md new file mode 100644 index 000000000..d41254e55 --- /dev/null +++ b/tests/format/markdown/list/issue-17746.md @@ -0,0 +1,8 @@ +- a + + - b + +- c + + + - d diff --git a/tests/format/markdown/spec/__snapshots__/format.test.js.snap b/tests/format/markdown/spec/__snapshots__/format.test.js.snap index 34b658454..96a2b336e 100644 --- a/tests/format/markdown/spec/__snapshots__/format.test.js.snap +++ b/tests/format/markdown/spec/__snapshots__/format.test.js.snap @@ -1559,6 +1559,7 @@ proseWrap: "always" =====================================output===================================== 1. foo + - bar ================================================================================ @@ -4464,6 +4465,7 @@ proseWrap: "always" \`\`\` - baz + - \`\`\` foo diff --git a/tests/format/mdx/mdx/__snapshots__/format.test.js.snap b/tests/format/mdx/mdx/__snapshots__/format.test.js.snap index 25780546f..020522df9 100644 --- a/tests/format/mdx/mdx/__snapshots__/format.test.js.snap +++ b/tests/format/mdx/mdx/__snapshots__/format.test.js.snap @@ -376,6 +376,184 @@ opinionated-code-formatter-that-support-many-languages-and-integrate-with-most-e ================================================================================ `; +exports[`issue-17746.mdx - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["mdx"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +- a + + - b + +- c + + + - d + +=====================================output===================================== +- a + + - b + +- c + + - d + +================================================================================ +`; + +exports[`issue-17746.mdx format 1`] = ` +====================================options===================================== +parsers: ["mdx"] +printWidth: 80 + | printWidth +=====================================input====================================== +- a + + - b + +- c + + + - d + +=====================================output===================================== +- a + + - b + +- c + + - d + +================================================================================ +`; + +exports[`issue-17746-code-before-list.mdx - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["mdx"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +- a + - b +- c +- d + +=====================================output===================================== +- a + - b +- c +- d + +================================================================================ +`; + +exports[`issue-17746-code-before-list.mdx format 1`] = ` +====================================options===================================== +parsers: ["mdx"] +printWidth: 80 + | printWidth +=====================================input====================================== +- a + - b +- c +- d + +=====================================output===================================== +- a + - b +- c +- d + +================================================================================ +`; + +exports[`issue-17746-fenced-code-then-nested-list.mdx - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["mdx"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +- \`\`\` + a + \`\`\` + + - b + +=====================================output===================================== +- \`\`\` + a + \`\`\` + + - b + +================================================================================ +`; + +exports[`issue-17746-fenced-code-then-nested-list.mdx format 1`] = ` +====================================options===================================== +parsers: ["mdx"] +printWidth: 80 + | printWidth +=====================================input====================================== +- \`\`\` + a + \`\`\` + + - b + +=====================================output===================================== +- \`\`\` + a + \`\`\` + + - b + +================================================================================ +`; + +exports[`issue-17746-indented-code-then-nested-list.mdx - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["mdx"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +- a + + - b + +=====================================output===================================== +- a + + - b + +================================================================================ +`; + +exports[`issue-17746-indented-code-then-nested-list.mdx format 1`] = ` +====================================options===================================== +parsers: ["mdx"] +printWidth: 80 + | printWidth +=====================================input====================================== +- a + + - b + +=====================================output===================================== +- a + + - b + +================================================================================ +`; + exports[`jsx.mdx - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["mdx"] diff --git a/tests/format/mdx/mdx/issue-17746-code-before-list.mdx b/tests/format/mdx/mdx/issue-17746-code-before-list.mdx new file mode 100644 index 000000000..58d20f0b6 --- /dev/null +++ b/tests/format/mdx/mdx/issue-17746-code-before-list.mdx @@ -0,0 +1,4 @@ +- a + - b +- c +- d diff --git a/tests/format/mdx/mdx/issue-17746-fenced-code-then-nested-list.mdx b/tests/format/mdx/mdx/issue-17746-fenced-code-then-nested-list.mdx new file mode 100644 index 000000000..8091b6b02 --- /dev/null +++ b/tests/format/mdx/mdx/issue-17746-fenced-code-then-nested-list.mdx @@ -0,0 +1,5 @@ +- ``` + a + ``` + + - b diff --git a/tests/format/mdx/mdx/issue-17746-indented-code-then-nested-list.mdx b/tests/format/mdx/mdx/issue-17746-indented-code-then-nested-list.mdx new file mode 100644 index 000000000..d74648228 --- /dev/null +++ b/tests/format/mdx/mdx/issue-17746-indented-code-then-nested-list.mdx @@ -0,0 +1,3 @@ +- a + + - b diff --git a/tests/format/mdx/mdx/issue-17746.mdx b/tests/format/mdx/mdx/issue-17746.mdx new file mode 100644 index 000000000..d41254e55 --- /dev/null +++ b/tests/format/mdx/mdx/issue-17746.mdx @@ -0,0 +1,8 @@ +- a + + - b + +- c + + + - d From 1c6ba5539141552e0e8e22d401ea620d8fdff468 Mon Sep 17 00:00:00 2001 From: fisker Date: Tue, 9 Jun 2026 19:28:10 +0800 Subject: [PATCH 3/5] Release 3.8.4 --- .github/ISSUE_TEMPLATE/formatting.md | 2 +- .github/ISSUE_TEMPLATE/integration.md | 2 +- CHANGELOG.md | 36 +++++++++++++++++++ package.json | 2 +- .../versioned_docs/version-stable/browser.md | 36 +++++++++---------- 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 1c493aa7c..77de794d4 100644 --- a/.github/ISSUE_TEMPLATE/formatting.md +++ b/.github/ISSUE_TEMPLATE/formatting.md @@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you: --> -**Prettier 3.8.3** +**Prettier 3.8.4** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 85dd18b63..519b93b4f 100644 --- a/.github/ISSUE_TEMPLATE/integration.md +++ b/.github/ISSUE_TEMPLATE/integration.md @@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE: **Environments:** -- Prettier Version: 3.8.3 +- Prettier Version: 3.8.4 - Running Prettier via: - Runtime: - Operating System: diff --git a/CHANGELOG.md b/CHANGELOG.md index f73d9d1fa..7a6a88e15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,39 @@ +# 3.8.4 + +[diff](https://github.com/prettier/prettier/compare/3.8.3...3.8.4) + +#### Markdown: Fix blank lines between list items and nested sub-lists being removed in Markdown/MDX ([#17746](https://github.com/prettier/prettier/pull/17746) by [@byplayer](https://github.com/byplayer)) + +Prettier was removing blank lines between list items and their nested sub-lists, converting loose lists into tight lists and changing their semantic meaning. + + +```markdown + +- a + + - b + +- c + + + - d + + +- a + - b +- c + - d + + +- a + + - b + +- c + + - d +``` + # 3.8.3 [diff](https://github.com/prettier/prettier/compare/3.8.2...3.8.3) diff --git a/package.json b/package.json index eed1f88b4..ad02c6228 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prettier", - "version": "3.9.0-dev", + "version": "3.8.4", "description": "Prettier is an opinionated code formatter", "bin": "./bin/prettier.cjs", "repository": "prettier/prettier", diff --git a/website/versioned_docs/version-stable/browser.md b/website/versioned_docs/version-stable/browser.md index 6d2fc8a4e..c6c345c39 100644 --- a/website/versioned_docs/version-stable/browser.md +++ b/website/versioned_docs/version-stable/browser.md @@ -21,7 +21,7 @@ Required options: - **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use. -- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource-options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in [https://unpkg.com/browse/prettier@3.8.3/plugins](https://unpkg.com/browse/prettier@3.8.3/plugins). Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON. +- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource-options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in [https://unpkg.com/browse/prettier@3.8.4/plugins](https://unpkg.com/browse/prettier@3.8.4/plugins). Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON. You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option. @@ -32,8 +32,8 @@ See below for examples. ### Global ```html - - + +