[3.9.x] Markdown: Don't let Liquid objects interrupt paragraphs (#20087)

Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
Seiyaandfisker authored and GitHub committed 2026-09-18 05:02:50 +08:00
1 parent 5b142ed2bc
commit 5ec8db1745
4 files changed
+210 -2

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
#### Don't let Liquid objects interrupt paragraphs (#20087 by @seiyab)
<!-- prettier-ignore -->
```markdown
<!-- Input -->
If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a
{{jsxref("TypeError")}} is thrown.
<!-- Prettier stable -->
If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a
{{jsxref("TypeError")}} is thrown.
<!-- Prettier main -->
If `module` is not a [`WebAssembly.Module`](/en-US/docs/WebAssembly/Reference/JavaScript_interface/Module) object instance, a
{{jsxref("TypeError")}} is thrown.
```
@@ -77,7 +77,7 @@ function liquidSyntax() {
*/ */
function tokenize(effects, ok, nok, mode) { function tokenize(effects, ok, nok, mode) {
const isFlow = mode === "flow"; const isFlow = mode === "flow";
const { interrupt, now, parser } = this; const { now, parser } = this;
/** @type {typeof codes.rightCurlyBrace | typeof codes.percentSign} */ /** @type {typeof codes.rightCurlyBrace | typeof codes.percentSign} */
let closingCode; let closingCode;
@@ -97,7 +97,7 @@ function liquidSyntax() {
? codes.percentSign ? codes.percentSign
: codes.rightCurlyBrace; : codes.rightCurlyBrace;
effects.consume(code); effects.consume(code);
return isFlow && interrupt ? ok : inside; return inside;
default: default:
return nok(code); return nok(code);
} }
@@ -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`] = ` exports[`unbalanced-mismatched-braces.md - {"proseWrap":"always"} format 1`] = `
====================================options===================================== ====================================options=====================================
parsers: ["markdown"] parsers: ["markdown"]
@@ -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 %}