diff --git a/packages/comark/SPEC/GFM/alert.md b/packages/comark/SPEC/GFM/alert.md index 310068b..f6071dc 100644 --- a/packages/comark/SPEC/GFM/alert.md +++ b/packages/comark/SPEC/GFM/alert.md @@ -38,44 +38,28 @@ timeout: { "as": "caution" }, - [ - "p", - {}, - "Advises about risks or negative outcomes of certain actions." - ] + "Advises about risks or negative outcomes of certain actions." ], [ "blockquote", { "as": "important" }, - [ - "p", - {}, - "Key information users need to know to achieve their goal." - ] + "Key information users need to know to achieve their goal." ], [ "blockquote", { "as": "note" }, - [ - "p", - {}, - "Useful information that users should know, even when skimming content." - ] + "Useful information that users should know, even when skimming content." ], [ "blockquote", { "as": "tip" }, - [ - "p", - {}, - "Helpful advice for doing things better or more easily." - ] + "Helpful advice for doing things better or more easily." ], [ "blockquote", @@ -101,16 +85,16 @@ timeout: ```html
-

Advises about risks or negative outcomes of certain actions.

+ Advises about risks or negative outcomes of certain actions.
-

Key information users need to know to achieve their goal.

+ Key information users need to know to achieve their goal.
-

Useful information that users should know, even when skimming content.

+ Useful information that users should know, even when skimming content.
-

Helpful advice for doing things better or more easily.

+ Helpful advice for doing things better or more easily.

Urgent info that needs immediate user attention to avoid problems.

diff --git a/packages/comark/SPEC/GFM/wrapped-alert.md b/packages/comark/SPEC/GFM/wrapped-alert.md new file mode 100644 index 0000000..ffa2a02 --- /dev/null +++ b/packages/comark/SPEC/GFM/wrapped-alert.md @@ -0,0 +1,142 @@ +--- +timeout: + parse: 15ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +> [!CAUTION] +> Advises about risks or negative outcomes of certain actions. + +> [!IMPORTANT] +> Key information users need to know to achieve their goal. + +> [!NOTE] +> Useful information that users should know, even when skimming content. + +> [!TIP] +> Helpful advice for doing things better or more easily. + +> [!WARNING] +> Urgent info that needs immediate user attention to avoid problems. +> +> Stay sheltered. Don't leave your home. It's very dangerous outside. Bombs will be dropping everywhere. +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "blockquote", + { + "as": "caution" + }, + [ + "p", + {}, + "Advises about risks or negative outcomes of certain actions." + ] + ], + [ + "blockquote", + { + "as": "important" + }, + [ + "p", + {}, + "Key information users need to know to achieve their goal." + ] + ], + [ + "blockquote", + { + "as": "note" + }, + [ + "p", + {}, + "Useful information that users should know, even when skimming content." + ] + ], + [ + "blockquote", + { + "as": "tip" + }, + [ + "p", + {}, + "Helpful advice for doing things better or more easily." + ] + ], + [ + "blockquote", + { + "as": "warning" + }, + [ + "p", + {}, + "Urgent info that needs immediate user attention to avoid problems." + ], + [ + "p", + {}, + "Stay sheltered. Don't leave your home. It's very dangerous outside. Bombs will be dropping everywhere." + ] + ] + ] +} +``` + +## HTML + +```html +
+

Advises about risks or negative outcomes of certain actions.

+
+
+

Key information users need to know to achieve their goal.

+
+
+

Useful information that users should know, even when skimming content.

+
+
+

Helpful advice for doing things better or more easily.

+
+
+

Urgent info that needs immediate user attention to avoid problems.

+

Stay sheltered. Don't leave your home. It's very dangerous outside. Bombs will be dropping everywhere.

+
+``` + +## Markdown + +```md +> [!CAUTION] +> Advises about risks or negative outcomes of certain actions. + +> [!IMPORTANT] +> Key information users need to know to achieve their goal. + +> [!NOTE] +> Useful information that users should know, even when skimming content. + +> [!TIP] +> Helpful advice for doing things better or more easily. + +> [!WARNING] +> Urgent info that needs immediate user attention to avoid problems. +> +> Stay sheltered. Don't leave your home. It's very dangerous outside. Bombs will be dropping everywhere. +``` diff --git a/packages/comark/SPEC/MDC/component-nested.md b/packages/comark/SPEC/MDC/component-nested.md index fa0ff01..de00559 100644 --- a/packages/comark/SPEC/MDC/component-nested.md +++ b/packages/comark/SPEC/MDC/component-nested.md @@ -35,11 +35,7 @@ First Paragraph [ "child", {}, - [ - "p", - {}, - "Second Paragraph" - ] + "Second Paragraph" ] ] ] @@ -52,7 +48,7 @@ First Paragraph

First Paragraph

-

Second Paragraph

+ Second Paragraph
``` diff --git a/packages/comark/SPEC/MDC/component-nested2.md b/packages/comark/SPEC/MDC/component-nested2.md index 5062b2e..7b44ac3 100644 --- a/packages/comark/SPEC/MDC/component-nested2.md +++ b/packages/comark/SPEC/MDC/component-nested2.md @@ -35,11 +35,7 @@ First Paragraph [ "child", {}, - [ - "p", - {}, - "Second Paragraph" - ] + "Second Paragraph" ] ] ] @@ -52,7 +48,7 @@ First Paragraph

First Paragraph

-

Second Paragraph

+ Second Paragraph
``` diff --git a/packages/comark/SPEC/MDC/component-nested3.md b/packages/comark/SPEC/MDC/component-nested3.md index 1b6a416..c6e0d90 100644 --- a/packages/comark/SPEC/MDC/component-nested3.md +++ b/packages/comark/SPEC/MDC/component-nested3.md @@ -47,11 +47,7 @@ First Paragraph [ "grand-child", {}, - [ - "p", - {}, - "Third Paragraph" - ] + "Third Paragraph" ] ] ] @@ -67,7 +63,7 @@ First Paragraph

Second Paragraph

-

Third Paragraph

+ Third Paragraph
diff --git a/packages/comark/SPEC/MDC/component-nested4.md b/packages/comark/SPEC/MDC/component-nested4.md index e9b23be..18113df 100644 --- a/packages/comark/SPEC/MDC/component-nested4.md +++ b/packages/comark/SPEC/MDC/component-nested4.md @@ -3,8 +3,6 @@ timeout: parse: 50ms html: 5ms markdown: 5ms -options: - autoUnwrap: true --- ## Input diff --git a/packages/comark/SPEC/MDC/component-short+block.md b/packages/comark/SPEC/MDC/component-short+block.md index 793be59..8bcda25 100644 --- a/packages/comark/SPEC/MDC/component-short+block.md +++ b/packages/comark/SPEC/MDC/component-short+block.md @@ -38,22 +38,14 @@ Second Paragraph { "name": "first" }, - [ - "p", - {}, - "First Paragraph" - ] + "First Paragraph" ], [ "template", { "name": "second" }, - [ - "p", - {}, - "Second Paragraph" - ] + "Second Paragraph" ] ] ] @@ -66,10 +58,10 @@ Second Paragraph ``` diff --git a/packages/comark/SPEC/MDC/component-slot-default-named.md b/packages/comark/SPEC/MDC/component-slot-default-named.md index 4fd908e..66d0086 100644 --- a/packages/comark/SPEC/MDC/component-slot-default-named.md +++ b/packages/comark/SPEC/MDC/component-slot-default-named.md @@ -29,11 +29,7 @@ Default slot content { "name": "default" }, - [ - "p", - {}, - "Default slot content" - ] + "Default slot content" ] ] ] @@ -45,7 +41,7 @@ Default slot content ```html ``` diff --git a/packages/comark/SPEC/MDC/component-slot-default.md b/packages/comark/SPEC/MDC/component-slot-default.md index 0093e7b..e7dc460 100644 --- a/packages/comark/SPEC/MDC/component-slot-default.md +++ b/packages/comark/SPEC/MDC/component-slot-default.md @@ -23,11 +23,7 @@ Default slot content [ "component", {}, - [ - "p", - {}, - "Default slot content" - ] + "Default slot content" ] ] } @@ -37,7 +33,7 @@ Default slot content ```html -

Default slot content

+ Default slot content
``` diff --git a/packages/comark/SPEC/MDC/component-slots-with-default-named.md b/packages/comark/SPEC/MDC/component-slots-with-default-named.md index d80446f..38fab6e 100644 --- a/packages/comark/SPEC/MDC/component-slots-with-default-named.md +++ b/packages/comark/SPEC/MDC/component-slots-with-default-named.md @@ -32,22 +32,14 @@ Second Paragraph { "name": "first" }, - [ - "p", - {}, - "First Paragraph" - ] + "First Paragraph" ], [ "template", { "name": "default" }, - [ - "p", - {}, - "Second Paragraph" - ] + "Second Paragraph" ] ] ] @@ -59,10 +51,10 @@ Second Paragraph ```html ``` diff --git a/packages/comark/SPEC/MDC/component-slots.md b/packages/comark/SPEC/MDC/component-slots.md index 1a168ed..6b73385 100644 --- a/packages/comark/SPEC/MDC/component-slots.md +++ b/packages/comark/SPEC/MDC/component-slots.md @@ -32,22 +32,14 @@ Second Paragraph { "name": "first" }, - [ - "p", - {}, - "First Paragraph" - ] + "First Paragraph" ], [ "template", { "name": "second" }, - [ - "p", - {}, - "Second Paragraph" - ] + "Second Paragraph" ] ] ] @@ -59,10 +51,10 @@ Second Paragraph ```html ``` diff --git a/packages/comark/SPEC/MDC/emoji-inside-component-autounwrap.md b/packages/comark/SPEC/MDC/emoji-inside-component-autounwrap.md index 302bfd7..7b42dc7 100644 --- a/packages/comark/SPEC/MDC/emoji-inside-component-autounwrap.md +++ b/packages/comark/SPEC/MDC/emoji-inside-component-autounwrap.md @@ -4,7 +4,6 @@ timeout: html: 5ms markdown: 5ms options: - autoUnwrap: true plugins: - emoji --- diff --git a/packages/comark/SPEC/MDC/emoji-inside-component.md b/packages/comark/SPEC/MDC/emoji-inside-component.md index 8c12c40..7b42dc7 100644 --- a/packages/comark/SPEC/MDC/emoji-inside-component.md +++ b/packages/comark/SPEC/MDC/emoji-inside-component.md @@ -30,20 +30,12 @@ options: [ "alert", { "type": "success" }, - [ - "p", - {}, - "✅ Successfully deployed! 🚀" - ] + "✅ Successfully deployed! 🚀" ], [ "alert", { "type": "warning" }, - [ - "p", - {}, - "⚠️ Please backup your data before proceeding" - ] + "⚠️ Please backup your data before proceeding" ] ] } @@ -53,10 +45,10 @@ options: ```html -

✅ Successfully deployed! 🚀

+ ✅ Successfully deployed! 🚀
-

⚠️ Please backup your data before proceeding

+ ⚠️ Please backup your data before proceeding
``` diff --git a/packages/comark/SPEC/MDC/wrapped-component-nested.md b/packages/comark/SPEC/MDC/wrapped-component-nested.md new file mode 100644 index 0000000..5d4ceea --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-component-nested.md @@ -0,0 +1,72 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +::component +First Paragraph + + :::child + Second Paragraph + ::: +:: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "component", + {}, + [ + "p", + {}, + "First Paragraph" + ], + [ + "child", + {}, + [ + "p", + {}, + "Second Paragraph" + ] + ] + ] + ] +} +``` + +## HTML + +```html + +

First Paragraph

+ +

Second Paragraph

+
+
+``` + +## Markdown + +```md +::component +First Paragraph + + :::child + Second Paragraph + ::: +:: +``` diff --git a/packages/comark/SPEC/MDC/wrapped-component-nested2.md b/packages/comark/SPEC/MDC/wrapped-component-nested2.md new file mode 100644 index 0000000..c64490d --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-component-nested2.md @@ -0,0 +1,72 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +:::component +First Paragraph + + ::child + Second Paragraph + :: +::: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "component", + {}, + [ + "p", + {}, + "First Paragraph" + ], + [ + "child", + {}, + [ + "p", + {}, + "Second Paragraph" + ] + ] + ] + ] +} +``` + +## HTML + +```html + +

First Paragraph

+ +

Second Paragraph

+
+
+``` + +## Markdown + +```md +::component +First Paragraph + + :::child + Second Paragraph + ::: +:: +``` diff --git a/packages/comark/SPEC/MDC/wrapped-component-nested3.md b/packages/comark/SPEC/MDC/wrapped-component-nested3.md new file mode 100644 index 0000000..845e833 --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-component-nested3.md @@ -0,0 +1,92 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +::component +First Paragraph + + :::child + Second Paragraph + + ::::grand-child + Third Paragraph + :::: + ::: +:: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "component", + {}, + [ + "p", + {}, + "First Paragraph" + ], + [ + "child", + {}, + [ + "p", + {}, + "Second Paragraph" + ], + [ + "grand-child", + {}, + [ + "p", + {}, + "Third Paragraph" + ] + ] + ] + ] + ] +} +``` + +## HTML + +```html + +

First Paragraph

+ +

Second Paragraph

+ +

Third Paragraph

+
+
+
+``` + +## Markdown + +```md +::component +First Paragraph + + :::child + Second Paragraph + + ::::grand-child + Third Paragraph + :::: + ::: +:: +``` diff --git a/packages/comark/SPEC/MDC/wrapped-component-short+block.md b/packages/comark/SPEC/MDC/wrapped-component-short+block.md new file mode 100644 index 0000000..40766a1 --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-component-short+block.md @@ -0,0 +1,92 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +:no-sugar-syntax + +::component +#first +First Paragraph + +#second +Second Paragraph +:: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "no-sugar-syntax", + {} + ], + [ + "component", + {}, + [ + "template", + { + "name": "first" + }, + [ + "p", + {}, + "First Paragraph" + ] + ], + [ + "template", + { + "name": "second" + }, + [ + "p", + {}, + "Second Paragraph" + ] + ] + ] + ] +} +``` + +## HTML + +```html + + + + + +``` + +## Markdown + +```md +::no-sugar-syntax +:: + +::component +#first +First Paragraph + +#second +Second Paragraph +:: +``` diff --git a/packages/comark/SPEC/MDC/wrapped-component-slot-default-named.md b/packages/comark/SPEC/MDC/wrapped-component-slot-default-named.md new file mode 100644 index 0000000..b5c69d6 --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-component-slot-default-named.md @@ -0,0 +1,61 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +::component +#default +Default slot content +:: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "component", + {}, + [ + "template", + { + "name": "default" + }, + [ + "p", + {}, + "Default slot content" + ] + ] + ] + ] +} +``` + +## HTML + +```html + + + +``` + +## Markdown + +```md +::component +Default slot content +:: +``` diff --git a/packages/comark/SPEC/MDC/wrapped-component-slot-default.md b/packages/comark/SPEC/MDC/wrapped-component-slot-default.md new file mode 100644 index 0000000..4b9d7d7 --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-component-slot-default.md @@ -0,0 +1,52 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +::component +Default slot content +:: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "component", + {}, + [ + "p", + {}, + "Default slot content" + ] + ] + ] +} +``` + +## HTML + +```html + +

Default slot content

+
+``` + +## Markdown + +```md +::component +Default slot content +:: +``` diff --git a/packages/comark/SPEC/MDC/wrapped-component-slots-with-default-named.md b/packages/comark/SPEC/MDC/wrapped-component-slots-with-default-named.md new file mode 100644 index 0000000..e38af34 --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-component-slots-with-default-named.md @@ -0,0 +1,82 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +::component +#first +First Paragraph + +#default +Second Paragraph +:: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "component", + {}, + [ + "template", + { + "name": "first" + }, + [ + "p", + {}, + "First Paragraph" + ] + ], + [ + "template", + { + "name": "default" + }, + [ + "p", + {}, + "Second Paragraph" + ] + ] + ] + ] +} +``` + +## HTML + +```html + + + + +``` + +## Markdown + +```md +::component +#first +First Paragraph + +#default +Second Paragraph +:: +``` diff --git a/packages/comark/SPEC/MDC/wrapped-component-slots.md b/packages/comark/SPEC/MDC/wrapped-component-slots.md new file mode 100644 index 0000000..7760e1a --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-component-slots.md @@ -0,0 +1,82 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +::component +#first +First Paragraph + +#second +Second Paragraph +:: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "component", + {}, + [ + "template", + { + "name": "first" + }, + [ + "p", + {}, + "First Paragraph" + ] + ], + [ + "template", + { + "name": "second" + }, + [ + "p", + {}, + "Second Paragraph" + ] + ] + ] + ] +} +``` + +## HTML + +```html + + + + +``` + +## Markdown + +```md +::component +#first +First Paragraph + +#second +Second Paragraph +:: +``` diff --git a/packages/comark/SPEC/MDC/wrapped-emoji-inside-component.md b/packages/comark/SPEC/MDC/wrapped-emoji-inside-component.md new file mode 100644 index 0000000..d7c6962 --- /dev/null +++ b/packages/comark/SPEC/MDC/wrapped-emoji-inside-component.md @@ -0,0 +1,74 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false + plugins: + - emoji +--- + +## Input + +```md +::alert{type="success"} +:white_check_mark: Successfully deployed! :rocket: +:: + +::alert{type="warning"} +:warning: Please backup your data before proceeding +:: +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "alert", + { "type": "success" }, + [ + "p", + {}, + "✅ Successfully deployed! 🚀" + ] + ], + [ + "alert", + { "type": "warning" }, + [ + "p", + {}, + "⚠️ Please backup your data before proceeding" + ] + ] + ] +} +``` + +## HTML + +```html + +

✅ Successfully deployed! 🚀

+
+ +

⚠️ Please backup your data before proceeding

+
+``` + +## Markdown + +```md +::alert{type="success"} +✅ Successfully deployed! 🚀 +:: + +::alert{type="warning"} +⚠️ Please backup your data before proceeding +:: +``` diff --git a/packages/comark/SPEC/common-mark/blockquote-paragraph.md b/packages/comark/SPEC/common-mark/blockquote-paragraph.md index 36fe05c..9f2de95 100644 --- a/packages/comark/SPEC/common-mark/blockquote-paragraph.md +++ b/packages/comark/SPEC/common-mark/blockquote-paragraph.md @@ -21,11 +21,7 @@ timeout: [ "blockquote", {}, - [ - "p", - {}, - "This is a simple blockquote" - ] + "This is a simple blockquote" ] ] } @@ -35,7 +31,7 @@ timeout: ```html
-

This is a simple blockquote

+ This is a simple blockquote
``` diff --git a/packages/comark/SPEC/common-mark/wrapped-blockquote-paragraph.md b/packages/comark/SPEC/common-mark/wrapped-blockquote-paragraph.md new file mode 100644 index 0000000..019111f --- /dev/null +++ b/packages/comark/SPEC/common-mark/wrapped-blockquote-paragraph.md @@ -0,0 +1,48 @@ +--- +timeout: + parse: 5ms + html: 5ms + markdown: 5ms +options: + autoUnwrap: false +--- + +## Input + +```md +> This is a simple blockquote +``` + +## AST + +```json +{ + "frontmatter": {}, + "meta": {}, + "nodes": [ + [ + "blockquote", + {}, + [ + "p", + {}, + "This is a simple blockquote" + ] + ] + ] +} +``` + +## HTML + +```html +
+

This is a simple blockquote

+
+``` + +## Markdown + +```md +> This is a simple blockquote +``` diff --git a/packages/comark/test/index.test.ts b/packages/comark/test/index.test.ts index e195933..310380a 100644 --- a/packages/comark/test/index.test.ts +++ b/packages/comark/test/index.test.ts @@ -207,8 +207,7 @@ describe('Comark Tests', () => { } const parseOptions: ParseOptions = { - autoUnwrap: testCase.options?.autoUnwrap ?? false, - ...testCase.options?.highlight ? { highlight: testCase.options.highlight } : {}, + autoUnwrap: testCase.options?.autoUnwrap === false ? false : true, } if (plugins.length > 0) {