From 4a673dc9b59ddf7296bbab9822093d2971da84a8 Mon Sep 17 00:00:00 2001 From: "byplayer(Andy)" Date: Thu, 4 Jun 2026 19:21:03 +0900 Subject: [PATCH] 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