Fix mutiline opening inline html tag (#19477)
Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
1 parent
7eecbe3602
commit
ae594b849f
11 files changed
+400
-20
No files matched your search
@@ -97,7 +97,6 @@
|
||||
"micromark-extension-gfm": "3.0.0",
|
||||
"micromark-extension-math": "3.1.0",
|
||||
"micromark-extension-wiki-link": "0.0.4",
|
||||
"micromark-factory-space": "2.0.1",
|
||||
"micromark-util-character": "2.1.1",
|
||||
"micromark-util-symbol": "2.0.1",
|
||||
"micromark-util-types": "2.0.2",
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
* } from 'micromark-util-types'
|
||||
*/
|
||||
|
||||
import { factorySpace } from "micromark-factory-space";
|
||||
import {
|
||||
asciiAlpha,
|
||||
asciiAlphanumeric,
|
||||
@@ -758,22 +757,7 @@ function tokenizeHtmlText(effects, ok, nok) {
|
||||
"expected `disable.null` to be populated",
|
||||
);
|
||||
|
||||
if (!markdownSpace(code)) {
|
||||
return lineEndingAfterPrefix(code);
|
||||
}
|
||||
|
||||
if (marker === codes.quotationMark || marker === codes.apostrophe) {
|
||||
return lineEndingAfterPrefix(code);
|
||||
}
|
||||
|
||||
return factorySpace(
|
||||
effects,
|
||||
lineEndingAfterPrefix,
|
||||
types.linePrefix,
|
||||
self.parser.constructs.disable.null.includes("codeIndented")
|
||||
? undefined
|
||||
: constants.tabSize,
|
||||
)(code);
|
||||
return lineEndingAfterPrefix(code);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`multiline.md format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<docs-code
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
|
||||
<div
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
|
||||
<span
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
|
||||
=====================================output=====================================
|
||||
<docs-code
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
|
||||
<div
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
|
||||
<span
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`multiline-2.md format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<!-- https://github.com/prettier/prettier/pull/18467#discussion_r2614298105 -->
|
||||
|
||||
<table><tr><td>
|
||||
<pre>
|
||||
**Hello**,
|
||||
|
||||
_world_.
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
|
||||
<table><tr><td>
|
||||
pre
|
||||
**Hello**,
|
||||
|
||||
_world_.
|
||||
pre
|
||||
</td></tr></table>
|
||||
|
||||
=====================================output=====================================
|
||||
<!-- https://github.com/prettier/prettier/pull/18467#discussion_r2614298105 -->
|
||||
|
||||
<table><tr><td>
|
||||
<pre>
|
||||
**Hello**,
|
||||
|
||||
_world_.
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
|
||||
<table><tr><td>
|
||||
pre
|
||||
**Hello**,
|
||||
|
||||
_world_.
|
||||
pre
|
||||
</td></tr></table>
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`problematic-1.md format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<!--
|
||||
|
||||
The following takes from https://github.com/microsoft/vscode/blob/b949969d71c3788856872a52e3bc6441292046f9/.github/prompts/setup-environment.prompt.md?plain=1#L30-L43
|
||||
|
||||
According to commonmark \`</example>\` should be parsed as part of the list item
|
||||
|
||||
https://spec.commonmark.org/dingus/?text=%3Cexample%3E%0A%23%23%20Installation%20Summary%0A%0A%23%23%23%20%E2%9D%93%20Unable%20to%20Verify%0A-%20ToolName%20-%20%5BReason%20why%20it%20couldn%27t%20be%20verified%5D%0A%20%20-%20%5BManual%20verification%20instructions%20steps%5D%0A%3C%2Fexample%3E
|
||||
|
||||
But ... whatever
|
||||
|
||||
-->
|
||||
|
||||
<example>
|
||||
## Installation Summary
|
||||
|
||||
### ❓ Unable to Verify
|
||||
- ToolName - [Reason why it couldn't be verified]
|
||||
- [Manual verification instructions steps]
|
||||
</example>
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Added a blank line before \`</example>\`
|
||||
-->
|
||||
|
||||
<example>
|
||||
## Installation Summary
|
||||
|
||||
### ❓ Unable to Verify
|
||||
- ToolName - [Reason why it couldn't be verified]
|
||||
- [Manual verification instructions steps]
|
||||
|
||||
</example>
|
||||
|
||||
=====================================output=====================================
|
||||
<!--
|
||||
|
||||
The following takes from https://github.com/microsoft/vscode/blob/b949969d71c3788856872a52e3bc6441292046f9/.github/prompts/setup-environment.prompt.md?plain=1#L30-L43
|
||||
|
||||
According to commonmark \`</example>\` should be parsed as part of the list item
|
||||
|
||||
https://spec.commonmark.org/dingus/?text=%3Cexample%3E%0A%23%23%20Installation%20Summary%0A%0A%23%23%23%20%E2%9D%93%20Unable%20to%20Verify%0A-%20ToolName%20-%20%5BReason%20why%20it%20couldn%27t%20be%20verified%5D%0A%20%20-%20%5BManual%20verification%20instructions%20steps%5D%0A%3C%2Fexample%3E
|
||||
|
||||
But ... whatever
|
||||
|
||||
-->
|
||||
|
||||
<example>
|
||||
## Installation Summary
|
||||
|
||||
### ❓ Unable to Verify
|
||||
|
||||
- ToolName - [Reason why it couldn't be verified]
|
||||
- [Manual verification instructions steps]
|
||||
</example>
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Added a blank line before \`</example>\`
|
||||
-->
|
||||
|
||||
<example>
|
||||
## Installation Summary
|
||||
|
||||
### ❓ Unable to Verify
|
||||
|
||||
- ToolName - [Reason why it couldn't be verified]
|
||||
- [Manual verification instructions steps]
|
||||
|
||||
</example>
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`problematic-2.md format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<!--
|
||||
|
||||
The folling takes from https://github.com/vega/vega-lite/blob/91845a3bca89f9e8bd6ae847bc1b3f31cc85e919/site/docs/transform/aggregate.md?plain=1#L55-L56
|
||||
|
||||
According to commonmark the content inside \`<span>\` should be parsed as a link, but the \`<div>\` one should parsed as a whole "html"
|
||||
|
||||
https://spec.commonmark.org/dingus/?text=%3Cspan%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fspan%3E%0A%0A%3Cdiv%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fdiv%3E%0A%0A%3Cno-a-html-tag%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fno-a-html-tag%3E
|
||||
|
||||
-->
|
||||
|
||||
<span>... [dimensions](<https://en.wikipedia.org/wiki/Dimension>) ... </span>
|
||||
|
||||
<div>... [dimensions](<https://en.wikipedia.org/wiki/Dimension>) ... </div>
|
||||
|
||||
<no-a-html-tag>... [dimensions](<https://en.wikipedia.org/wiki/Dimension>) ... </no-a-html-tag>
|
||||
|
||||
=====================================output=====================================
|
||||
<!--
|
||||
|
||||
The folling takes from https://github.com/vega/vega-lite/blob/91845a3bca89f9e8bd6ae847bc1b3f31cc85e919/site/docs/transform/aggregate.md?plain=1#L55-L56
|
||||
|
||||
According to commonmark the content inside \`<span>\` should be parsed as a link, but the \`<div>\` one should parsed as a whole "html"
|
||||
|
||||
https://spec.commonmark.org/dingus/?text=%3Cspan%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fspan%3E%0A%0A%3Cdiv%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fdiv%3E%0A%0A%3Cno-a-html-tag%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fno-a-html-tag%3E
|
||||
|
||||
-->
|
||||
|
||||
<span>... [dimensions](https://en.wikipedia.org/wiki/Dimension) ... </span>
|
||||
|
||||
<div>... [dimensions](<https://en.wikipedia.org/wiki/Dimension>) ... </div>
|
||||
|
||||
<no-a-html-tag>... [dimensions](https://en.wikipedia.org/wiki/Dimension) ... </no-a-html-tag>
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`problematic-3.md format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<!--
|
||||
|
||||
I guess it doesn't matter for new lines between anchor and title
|
||||
|
||||
-->
|
||||
|
||||
<a name="2.0.0-alpha.1"></a>
|
||||
# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22)
|
||||
|
||||
---
|
||||
|
||||
<a name="2.0.0-alpha.1"></a>
|
||||
|
||||
# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22)
|
||||
|
||||
=====================================output=====================================
|
||||
<!--
|
||||
|
||||
I guess it doesn't matter for new lines between anchor and title
|
||||
|
||||
-->
|
||||
|
||||
<a name="2.0.0-alpha.1"></a>
|
||||
|
||||
# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22)
|
||||
|
||||
---
|
||||
|
||||
<a name="2.0.0-alpha.1"></a>
|
||||
|
||||
# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22)
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`problematic-4.md format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["markdown"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
<!--
|
||||
|
||||
The folllowing takes from https://github.com/formio/angular/blob/a72af4c9989666502e89d5daaf27e8d1ea6fa6e3/README.md?plain=1#L204-L205
|
||||
|
||||
The space should be able to collapse
|
||||
|
||||
-->
|
||||
|
||||
<a href="https://form.io" target="_blank">Form.io</a> Text after link.
|
||||
|
||||
=====================================output=====================================
|
||||
<!--
|
||||
|
||||
The folllowing takes from https://github.com/formio/angular/blob/a72af4c9989666502e89d5daaf27e8d1ea6fa6e3/README.md?plain=1#L204-L205
|
||||
|
||||
The space should be able to collapse
|
||||
|
||||
-->
|
||||
|
||||
<a href="https://form.io" target="_blank">Form.io</a> Text after link.
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -0,0 +1 @@
|
||||
runFormatTest(import.meta, ["markdown"]);
|
||||
@@ -0,0 +1,17 @@
|
||||
<!-- https://github.com/prettier/prettier/pull/18467#discussion_r2614298105 -->
|
||||
|
||||
<table><tr><td>
|
||||
<pre>
|
||||
**Hello**,
|
||||
|
||||
_world_.
|
||||
</pre>
|
||||
</td></tr></table>
|
||||
|
||||
<table><tr><td>
|
||||
pre
|
||||
**Hello**,
|
||||
|
||||
_world_.
|
||||
pre
|
||||
</td></tr></table>
|
||||
@@ -0,0 +1,20 @@
|
||||
<docs-code
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
|
||||
<div
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
|
||||
<span
|
||||
header="app.ts"
|
||||
path="adev/src/content/examples/signal-forms/src/login-validation-complete/app/app.ts"
|
||||
visibleLines="[21,22,23,24,25,26,27]"
|
||||
highlight="[23,24,26]"
|
||||
/>
|
||||
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
|
||||
The following takes from https://github.com/microsoft/vscode/blob/b949969d71c3788856872a52e3bc6441292046f9/.github/prompts/setup-environment.prompt.md?plain=1#L30-L43
|
||||
|
||||
According to commonmark `</example>` should be parsed as part of the list item
|
||||
|
||||
https://spec.commonmark.org/dingus/?text=%3Cexample%3E%0A%23%23%20Installation%20Summary%0A%0A%23%23%23%20%E2%9D%93%20Unable%20to%20Verify%0A-%20ToolName%20-%20%5BReason%20why%20it%20couldn%27t%20be%20verified%5D%0A%20%20-%20%5BManual%20verification%20instructions%20steps%5D%0A%3C%2Fexample%3E
|
||||
|
||||
But ... whatever
|
||||
|
||||
-->
|
||||
|
||||
<example>
|
||||
## Installation Summary
|
||||
|
||||
### ❓ Unable to Verify
|
||||
- ToolName - [Reason why it couldn't be verified]
|
||||
- [Manual verification instructions steps]
|
||||
</example>
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Added a blank line before `</example>`
|
||||
-->
|
||||
|
||||
<example>
|
||||
## Installation Summary
|
||||
|
||||
### ❓ Unable to Verify
|
||||
- ToolName - [Reason why it couldn't be verified]
|
||||
- [Manual verification instructions steps]
|
||||
|
||||
</example>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!--
|
||||
|
||||
The folling takes from https://github.com/vega/vega-lite/blob/91845a3bca89f9e8bd6ae847bc1b3f31cc85e919/site/docs/transform/aggregate.md?plain=1#L55-L56
|
||||
|
||||
According to commonmark the content inside `<span>` should be parsed as a link, but the `<div>` one should parsed as a whole "html"
|
||||
|
||||
https://spec.commonmark.org/dingus/?text=%3Cspan%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fspan%3E%0A%0A%3Cdiv%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fdiv%3E%0A%0A%3Cno-a-html-tag%3E...%20%5Bdimensions%5D(%3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDimension%3E)%20...%20%3C%2Fno-a-html-tag%3E
|
||||
|
||||
-->
|
||||
|
||||
<span>... [dimensions](<https://en.wikipedia.org/wiki/Dimension>) ... </span>
|
||||
|
||||
<div>... [dimensions](<https://en.wikipedia.org/wiki/Dimension>) ... </div>
|
||||
|
||||
<no-a-html-tag>... [dimensions](<https://en.wikipedia.org/wiki/Dimension>) ... </no-a-html-tag>
|
||||
@@ -0,0 +1,14 @@
|
||||
<!--
|
||||
|
||||
I guess it doesn't matter for new lines between anchor and title
|
||||
|
||||
-->
|
||||
|
||||
<a name="2.0.0-alpha.1"></a>
|
||||
# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22)
|
||||
|
||||
---
|
||||
|
||||
<a name="2.0.0-alpha.1"></a>
|
||||
|
||||
# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22)
|
||||
@@ -0,0 +1,9 @@
|
||||
<!--
|
||||
|
||||
The folllowing takes from https://github.com/formio/angular/blob/a72af4c9989666502e89d5daaf27e8d1ea6fa6e3/README.md?plain=1#L204-L205
|
||||
|
||||
The space should be able to collapse
|
||||
|
||||
-->
|
||||
|
||||
<a href="https://form.io" target="_blank">Form.io</a> Text after link.
|
||||
@@ -6946,7 +6946,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"micromark-factory-space@npm:2.0.1, micromark-factory-space@npm:^2.0.0":
|
||||
"micromark-factory-space@npm:^2.0.0":
|
||||
version: 2.0.1
|
||||
resolution: "micromark-factory-space@npm:2.0.1"
|
||||
dependencies:
|
||||
@@ -8014,7 +8014,6 @@ __metadata:
|
||||
micromark-extension-gfm: "npm:3.0.0"
|
||||
micromark-extension-math: "npm:3.1.0"
|
||||
micromark-extension-wiki-link: "npm:0.0.4"
|
||||
micromark-factory-space: "npm:2.0.1"
|
||||
micromark-util-character: "npm:2.1.1"
|
||||
micromark-util-symbol: "npm:2.0.1"
|
||||
micromark-util-types: "npm:2.0.2"
|
||||
|
||||
Reference in new issue
Block a user