diff --git a/package.json b/package.json index 80a25baa2..a5ca1f4c8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/language-markdown/parse/micromark/micromark-extension-html-text.js b/src/language-markdown/parse/micromark/micromark-extension-html-text.js index e0a09be25..7ed10a7e0 100644 --- a/src/language-markdown/parse/micromark/micromark-extension-html-text.js +++ b/src/language-markdown/parse/micromark/micromark-extension-html-text.js @@ -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); } /** diff --git a/tests/format/markdown/html/html/__snapshots__/format.test.js.snap b/tests/format/markdown/html/html/__snapshots__/format.test.js.snap new file mode 100644 index 000000000..abd2cf5a4 --- /dev/null +++ b/tests/format/markdown/html/html/__snapshots__/format.test.js.snap @@ -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====================================== + + +
+ + + +=====================================output===================================== + + +
+ + + +================================================================================ +`; + +exports[`multiline-2.md format 1`] = ` +====================================options===================================== +parsers: ["markdown"] + printWidth: 80 (default) | +=====================================input====================================== + + +
+
+**Hello**,
+
+_world_.
+
+
+ +
+pre +**Hello**, + +_world_. +pre +
+ +=====================================output===================================== + + +
+
+**Hello**,
+
+_world_.
+
+
+ +
+pre +**Hello**, + +_world_. +pre +
+ +================================================================================ +`; + +exports[`problematic-1.md format 1`] = ` +====================================options===================================== +parsers: ["markdown"] + printWidth: 80 (default) | +=====================================input====================================== + + + +## Installation Summary + +### ❓ Unable to Verify +- ToolName - [Reason why it couldn't be verified] + - [Manual verification instructions steps] + + +--- + + + + +## Installation Summary + +### ❓ Unable to Verify +- ToolName - [Reason why it couldn't be verified] + - [Manual verification instructions steps] + + + +=====================================output===================================== + + + +## Installation Summary + +### ❓ Unable to Verify + +- ToolName - [Reason why it couldn't be verified] + - [Manual verification instructions steps] + + +--- + + + + +## Installation Summary + +### ❓ Unable to Verify + +- ToolName - [Reason why it couldn't be verified] + - [Manual verification instructions steps] + + + +================================================================================ +`; + +exports[`problematic-2.md format 1`] = ` +====================================options===================================== +parsers: ["markdown"] + printWidth: 80 (default) | +=====================================input====================================== + + +... [dimensions]() ... + +
... [dimensions]() ...
+ +... [dimensions]() ... + +=====================================output===================================== + + +... [dimensions](https://en.wikipedia.org/wiki/Dimension) ... + +
... [dimensions]() ...
+ +... [dimensions](https://en.wikipedia.org/wiki/Dimension) ... + +================================================================================ +`; + +exports[`problematic-3.md format 1`] = ` +====================================options===================================== +parsers: ["markdown"] + printWidth: 80 (default) | +=====================================input====================================== + + + +# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22) + +--- + + + +# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22) + +=====================================output===================================== + + + + +# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22) + +--- + + + +# [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====================================== + + +Form.io Text after link. + +=====================================output===================================== + + +Form.io Text after link. + +================================================================================ +`; diff --git a/tests/format/markdown/html/html/format.test.js b/tests/format/markdown/html/html/format.test.js new file mode 100644 index 000000000..7df6c9eaa --- /dev/null +++ b/tests/format/markdown/html/html/format.test.js @@ -0,0 +1 @@ +runFormatTest(import.meta, ["markdown"]); diff --git a/tests/format/markdown/html/html/multiline-2.md b/tests/format/markdown/html/html/multiline-2.md new file mode 100644 index 000000000..d6cf680ed --- /dev/null +++ b/tests/format/markdown/html/html/multiline-2.md @@ -0,0 +1,17 @@ + + +
+
+**Hello**,
+
+_world_.
+
+
+ +
+pre +**Hello**, + +_world_. +pre +
diff --git a/tests/format/markdown/html/html/multiline.md b/tests/format/markdown/html/html/multiline.md new file mode 100644 index 000000000..fb1c3f97d --- /dev/null +++ b/tests/format/markdown/html/html/multiline.md @@ -0,0 +1,20 @@ + + +
+ + diff --git a/tests/format/markdown/html/html/problematic-1.md b/tests/format/markdown/html/html/problematic-1.md new file mode 100644 index 000000000..0fd72d76d --- /dev/null +++ b/tests/format/markdown/html/html/problematic-1.md @@ -0,0 +1,34 @@ + + + +## Installation Summary + +### ❓ Unable to Verify +- ToolName - [Reason why it couldn't be verified] + - [Manual verification instructions steps] + + +--- + + + + +## Installation Summary + +### ❓ Unable to Verify +- ToolName - [Reason why it couldn't be verified] + - [Manual verification instructions steps] + + diff --git a/tests/format/markdown/html/html/problematic-2.md b/tests/format/markdown/html/html/problematic-2.md new file mode 100644 index 000000000..275ee025b --- /dev/null +++ b/tests/format/markdown/html/html/problematic-2.md @@ -0,0 +1,15 @@ + + +... [dimensions]() ... + +
... [dimensions]() ...
+ +... [dimensions]() ... diff --git a/tests/format/markdown/html/html/problematic-3.md b/tests/format/markdown/html/html/problematic-3.md new file mode 100644 index 000000000..b0c895589 --- /dev/null +++ b/tests/format/markdown/html/html/problematic-3.md @@ -0,0 +1,14 @@ + + + +# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22) + +--- + + + +# [2.0.0-alpha.1](https://github.com/formio/angular-formio/compare/v2.0.0-alpha.1...v1.18.0) (2018-03-22) diff --git a/tests/format/markdown/html/html/problematic-4.md b/tests/format/markdown/html/html/problematic-4.md new file mode 100644 index 000000000..434fdfe45 --- /dev/null +++ b/tests/format/markdown/html/html/problematic-4.md @@ -0,0 +1,9 @@ + + +Form.io Text after link. diff --git a/yarn.lock b/yarn.lock index 3ab4c858d..f9716c445 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"