From 5ec8db1745c2bdcca3706ab8cfbbe5c11fc457c1 Mon Sep 17 00:00:00 2001 From: Seiya <20365512+seiyab@users.noreply.github.com> Date: Fri, 18 Sep 2026 06:02:50 +0900 Subject: [PATCH 1/7] [3.9.x] Markdown: Don't let Liquid objects interrupt paragraphs (#20087) Co-authored-by: fisker --- changelog_unreleased/markdown/20087.md | 17 ++ .../micromark/micromark-extension-liquid.js | 4 +- .../liquid/__snapshots__/format.test.js.snap | 157 ++++++++++++++++++ tests/format/markdown/liquid/issue-20083.md | 34 ++++ 4 files changed, 210 insertions(+), 2 deletions(-) create mode 100644 changelog_unreleased/markdown/20087.md create mode 100644 tests/format/markdown/liquid/issue-20083.md diff --git a/changelog_unreleased/markdown/20087.md b/changelog_unreleased/markdown/20087.md new file mode 100644 index 000000000..36a8e5ea1 --- /dev/null +++ b/changelog_unreleased/markdown/20087.md @@ -0,0 +1,17 @@ +#### Don't let Liquid objects interrupt paragraphs (#20087 by @seiyab) + + +```markdown + +If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a +{{jsxref("TypeError")}} is thrown. + + +If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a + +{{jsxref("TypeError")}} is thrown. + + +If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a +{{jsxref("TypeError")}} is thrown. +``` diff --git a/src/language-markdown/parse/micromark/micromark-extension-liquid.js b/src/language-markdown/parse/micromark/micromark-extension-liquid.js index 45b011a28..48a7ce40f 100644 --- a/src/language-markdown/parse/micromark/micromark-extension-liquid.js +++ b/src/language-markdown/parse/micromark/micromark-extension-liquid.js @@ -77,7 +77,7 @@ function liquidSyntax() { */ function tokenize(effects, ok, nok, mode) { const isFlow = mode === "flow"; - const { interrupt, now, parser } = this; + const { now, parser } = this; /** @type {typeof codes.rightCurlyBrace | typeof codes.percentSign} */ let closingCode; @@ -97,7 +97,7 @@ function liquidSyntax() { ? codes.percentSign : codes.rightCurlyBrace; effects.consume(code); - return isFlow && interrupt ? ok : inside; + return inside; default: return nok(code); } diff --git a/tests/format/markdown/liquid/__snapshots__/format.test.js.snap b/tests/format/markdown/liquid/__snapshots__/format.test.js.snap index 75ed735b3..502830af0 100644 --- a/tests/format/markdown/liquid/__snapshots__/format.test.js.snap +++ b/tests/format/markdown/liquid/__snapshots__/format.test.js.snap @@ -511,6 +511,163 @@ Inline {{ liquid }} stays inline. ================================================================================ `; +exports[`issue-20083.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +proseWrap: "always" + printWidth: 80 (default) | +=====================================input====================================== +Taken from https://github.com/mdn/content/blob/3f221b9845703eb21db70cdc321f843d5c1c072b/files/en-us/webassembly/reference/javascript_interface/module/customsections_static/index.md?plain=1#L32-L33 + +If \`module\` is not a [\`WebAssembly.Module\`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a +{{jsxref("TypeError")}} is thrown. + +--- + +text +{% comment %} here is comment {% endcomment %} + +--- + +text +{{ comment }} here is comment {{ endcomment }} + +--- + +text +{% comment %} text + +--- + +text +{{ comment }} text + +--- + +text +{{abc}} + +--- + +text +{% tag %} + +=====================================output===================================== +Taken from +https://github.com/mdn/content/blob/3f221b9845703eb21db70cdc321f843d5c1c072b/files/en-us/webassembly/reference/javascript_interface/module/customsections_static/index.md?plain=1#L32-L33 + +If \`module\` is not a +[\`WebAssembly.Module\`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) +object instance, a {{jsxref("TypeError")}} is thrown. + +--- + +text {% comment %} here is comment {% endcomment %} + +--- + +text {{ comment }} here is comment {{ endcomment }} + +--- + +text {% comment %} text + +--- + +text {{ comment }} text + +--- + +text +{{abc}} + +--- + +text +{% tag %} + +================================================================================ +`; + +exports[`issue-20083.md format 1`] = ` +====================================options===================================== +parsers: ["markdown"] + printWidth: 80 (default) | +=====================================input====================================== +Taken from https://github.com/mdn/content/blob/3f221b9845703eb21db70cdc321f843d5c1c072b/files/en-us/webassembly/reference/javascript_interface/module/customsections_static/index.md?plain=1#L32-L33 + +If \`module\` is not a [\`WebAssembly.Module\`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a +{{jsxref("TypeError")}} is thrown. + +--- + +text +{% comment %} here is comment {% endcomment %} + +--- + +text +{{ comment }} here is comment {{ endcomment }} + +--- + +text +{% comment %} text + +--- + +text +{{ comment }} text + +--- + +text +{{abc}} + +--- + +text +{% tag %} + +=====================================output===================================== +Taken from https://github.com/mdn/content/blob/3f221b9845703eb21db70cdc321f843d5c1c072b/files/en-us/webassembly/reference/javascript_interface/module/customsections_static/index.md?plain=1#L32-L33 + +If \`module\` is not a [\`WebAssembly.Module\`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a +{{jsxref("TypeError")}} is thrown. + +--- + +text +{% comment %} here is comment {% endcomment %} + +--- + +text +{{ comment }} here is comment {{ endcomment }} + +--- + +text +{% comment %} text + +--- + +text +{{ comment }} text + +--- + +text +{{abc}} + +--- + +text +{% tag %} + +================================================================================ +`; + exports[`unbalanced-mismatched-braces.md - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["markdown"] diff --git a/tests/format/markdown/liquid/issue-20083.md b/tests/format/markdown/liquid/issue-20083.md new file mode 100644 index 000000000..2fce9bc69 --- /dev/null +++ b/tests/format/markdown/liquid/issue-20083.md @@ -0,0 +1,34 @@ +Taken from https://github.com/mdn/content/blob/3f221b9845703eb21db70cdc321f843d5c1c072b/files/en-us/webassembly/reference/javascript_interface/module/customsections_static/index.md?plain=1#L32-L33 + +If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a +{{jsxref("TypeError")}} is thrown. + +--- + +text +{% comment %} here is comment {% endcomment %} + +--- + +text +{{ comment }} here is comment {{ endcomment }} + +--- + +text +{% comment %} text + +--- + +text +{{ comment }} text + +--- + +text +{{abc}} + +--- + +text +{% tag %} From 3d82af8b15b8e89de20dd05cc65f66ab6d4ce8b0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 16 Sep 2026 22:41:33 +0800 Subject: [PATCH 2/7] Update Regex related dependencies (#20082) # Conflicts: # package.json # yarn.lock --- package.json | 6 +++--- yarn.lock | 36 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 847377a5b..984f4799c 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "angular-html-parser": "10.12.0", "camelcase": "9.0.0", "ci-info": "4.4.0", - "cjk-regex": "3.4.0", + "cjk-regex": "3.5.0", "collapse-white-space": "1.0.6", "css-units-list": "2.1.0", "dashify": "2.0.0", @@ -115,7 +115,7 @@ "postcss-scss": "4.0.9", "postcss-selector-parser": "2.2.3", "postcss-values-parser": "2.0.1", - "regexp-util": "2.0.3", + "regexp-util": "2.1.0", "remark-footnotes": "2.0.0", "remark-math": "3.0.1", "remark-parse": "8.0.3", @@ -125,7 +125,7 @@ "to-fast-properties": "4.0.0", "trim-newlines": "5.0.0", "typescript": "6.0.3", - "unicode-regex": "4.2.0", + "unicode-regex": "4.3.0", "unified": "9.2.2", "url-or-path": "2.7.1", "vnopts": "2.0.5", diff --git a/yarn.lock b/yarn.lock index f764ac13b..a2797fd88 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3779,13 +3779,13 @@ __metadata: languageName: node linkType: hard -"cjk-regex@npm:3.4.0": - version: 3.4.0 - resolution: "cjk-regex@npm:3.4.0" +"cjk-regex@npm:3.5.0": + version: 3.5.0 + resolution: "cjk-regex@npm:3.5.0" dependencies: - regexp-util: "npm:^2.0.3" - unicode-regex: "npm:^4.2.0" - checksum: 10/930de9aa96a7b6195515abcf549743c149a4dcfed9b6b07a1f13e1f3376c2bdb4d16460bbff9038f1d63c59c5635d654a4792c273443beae2fd77a7e665b59a1 + regexp-util: "npm:^2.1.0" + unicode-regex: "npm:^4.3.0" + checksum: 10/4678377bac3cb37d5885f5c77f20fe266b757b89ff00ff1e5441067cef13a1cfedca059b766adb8b9084faa09633c6214eb41bfcd58a73146c67b8840fe653ea languageName: node linkType: hard @@ -8342,7 +8342,7 @@ __metadata: c8: "npm:11.0.0" camelcase: "npm:9.0.0" ci-info: "npm:4.4.0" - cjk-regex: "npm:3.4.0" + cjk-regex: "npm:3.5.0" collapse-white-space: "npm:1.0.6" commonmark-test-suite: "npm:0.1.0" cross-env: "npm:10.1.0" @@ -8437,7 +8437,7 @@ __metadata: pretty-bytes: "npm:7.1.0" pretty-ms: "npm:9.3.0" puppeteer: "npm:25.3.0" - regexp-util: "npm:2.0.3" + regexp-util: "npm:2.1.0" remark-footnotes: "npm:2.0.0" remark-math: "npm:3.0.1" remark-parse: "npm:8.0.3" @@ -8453,7 +8453,7 @@ __metadata: trim-newlines: "npm:5.0.0" ts-expect: "npm:1.3.0" typescript: "npm:6.0.3" - unicode-regex: "npm:4.2.0" + unicode-regex: "npm:4.3.0" unified: "npm:9.2.2" url-or-path: "npm:2.7.1" vnopts: "npm:2.0.5" @@ -8635,10 +8635,10 @@ __metadata: languageName: node linkType: hard -"regexp-util@npm:2.0.3, regexp-util@npm:^2.0.3": - version: 2.0.3 - resolution: "regexp-util@npm:2.0.3" - checksum: 10/8380aa27dc61013b21a01ce1679d61323e6930ce0d3776171045c1ed73e3ba70c5da1cf02d65d9f1f97d1b944de617ff0d609eadce7832344ed8f096919a55ba +"regexp-util@npm:2.1.0, regexp-util@npm:^2.1.0": + version: 2.1.0 + resolution: "regexp-util@npm:2.1.0" + checksum: 10/f90f38c910e1f845c1939ed0a40cb0430ca630808e73d1a4ed6b8134fbc6d4735d438eb14cfb74415c7df6c4627b21f1312db34bae6aa024cdfae04887a89a5d languageName: node linkType: hard @@ -9607,12 +9607,12 @@ __metadata: languageName: node linkType: hard -"unicode-regex@npm:4.2.0, unicode-regex@npm:^4.2.0": - version: 4.2.0 - resolution: "unicode-regex@npm:4.2.0" +"unicode-regex@npm:4.3.0, unicode-regex@npm:^4.3.0": + version: 4.3.0 + resolution: "unicode-regex@npm:4.3.0" dependencies: - regexp-util: "npm:^2.0.3" - checksum: 10/0ac31e030817e2596cd5f5476a4c450edc4a25e0db00a77b69769cc747ec66d03a76fa9687c7c5e8029d316a18eb0d5564569e71a8d7e66db68d0697be588946 + regexp-util: "npm:^2.1.0" + checksum: 10/a8fa523ce8a8dde46cbe4471d978d5b01eb5fde55ec1ab707a2a646581e01ccd19b7d04cf2e08aa4edc0c64057366c600e19d910f3571eda27b729df855d5b03 languageName: node linkType: hard From 4f2ab6765d7cb29408a2abdac75d023d64d44107 Mon Sep 17 00:00:00 2001 From: fisker Date: Fri, 18 Sep 2026 05:33:16 +0800 Subject: [PATCH 3/7] Release 3.9.8 --- .github/ISSUE_TEMPLATE/formatting.md | 2 +- .github/ISSUE_TEMPLATE/integration.md | 2 +- CHANGELOG.md | 22 ++++++++++++ package.json | 2 +- .../versioned_docs/version-stable/browser.md | 36 +++++++++---------- .../versioned_docs/version-stable/install.md | 10 +++--- .../version-stable/sharing-configurations.md | 4 +-- 7 files changed, 50 insertions(+), 28 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 823cb8b4b..51afd79a3 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.9.7** +**Prettier 3.9.8** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 70501cfcf..7159721e9 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.9.7 +- Prettier Version: 3.9.8 - Running Prettier via: - Runtime: - Operating System: diff --git a/CHANGELOG.md b/CHANGELOG.md index dea72898b..1ee7ce72d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +# 3.9.8 + +[diff](https://github.com/prettier/prettier/compare/3.9.7...3.9.8) + +#### Markdown: Don't let Liquid objects interrupt paragraphs ([#20087](https://github.com/prettier/prettier/pull/20087) by [@seiyab](https://github.com/seiyab)) + + +```markdown + +If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a +{{jsxref("TypeError")}} is thrown. + + +If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a + +{{jsxref("TypeError")}} is thrown. + + +If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a +{{jsxref("TypeError")}} is thrown. +``` + # 3.9.7 [diff](https://github.com/prettier/prettier/compare/3.9.6...3.9.7) diff --git a/package.json b/package.json index 984f4799c..74e442e1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prettier", - "version": "3.10.0-dev", + "version": "3.9.8", "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 46e13a238..0bed0c14c 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.9.7/plugins](https://unpkg.com/browse/prettier@3.9.7/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.9.8/plugins](https://unpkg.com/browse/prettier@3.9.8/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 - - + +