diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a78d349..a40decc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '20' - - run: corepack enable + - run: npm i -g --force corepack && corepack enable - run: pnpm install - run: pnpm dev:prepare - run: pnpm lint diff --git a/src/index.ts b/src/index.ts index 7eb7522..21e1058 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,6 +44,9 @@ export default >> function remarkMDC(opts: Remark if (opts.yamlCodeBlockProps === undefined && opts.experimental?.componentCodeBlockYamlProps) { opts.yamlCodeBlockProps = opts.experimental.componentCodeBlockYamlProps } + if (typeof opts.indentContent === 'undefined') { + opts.indentContent = true + } add('micromarkExtensions', syntax()) add('fromMarkdownExtensions', fromMarkdown(opts)) diff --git a/src/to-markdown.ts b/src/to-markdown.ts index e93866d..9c5cd79 100644 --- a/src/to-markdown.ts +++ b/src/to-markdown.ts @@ -41,6 +41,14 @@ function compilePattern(pattern: Unsafe) { type NodeComponentContainerSection = Parents & { name: string } export default (opts: RemarkMDCOptions = {}) => { + const indentedContent = (node: any, context: State) => { + if (opts.indentContent) { + return content(node, context).split('\n') + .map(line => line.length > 0 ? ' ' + line : line) + .join('\n') + } + return content(node, context) + } const applyAutomaticUnwrap = (node: Container, { safeTypes = [] }: Exclude) => { const isSafe = (type: string) => NON_UNWRAPPABLE_TYPES.has(type) || safeTypes.includes(type) if (!node.mdc?.unwrapped) { @@ -97,7 +105,9 @@ export default (opts: RemarkMDCOptions = {}) => { processNode(node as any) - return `#${(node as any).name}${attributes(node, context)}\n${content(node, context)}`.trim() + const subvalue = indentedContent(node, context) + + return `#${(node as any).name}${attributes(node, context)}\n${subvalue}`.trim() } type NodeTextComponent = Parents & { name: string, rawData: string, attributes: any } @@ -164,18 +174,16 @@ export default (opts: RemarkMDCOptions = {}) => { let subvalue if ((node.type as string) === 'containerComponent') { - subvalue = content(node, context) + subvalue = node.children.map((child) => { + return child.type === 'componentContainerSection' + ? content({ children: [child] }, context) + : indentedContent({ children: [child] }, context) + }).join('\n\n') + if (subvalue) { value += '\n' + subvalue } value += '\n' + prefix - - if (nest > 1) { - value = value - .split('\n') - .map(line => ' ' + line) - .join('\n') - } } nest -= 1 exit() diff --git a/src/types.d.ts b/src/types.d.ts index 5217f24..9ef386d 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -11,6 +11,7 @@ export interface RemarkMDCOptions { safeTypes?: Array } yamlCodeBlockProps?: boolean + indentContent?: boolean experimental?: { /** * @deprecated This feature is out of experimental, use `autoUnwrap` diff --git a/test/__snapshots__/block-component.test.ts.snap b/test/__snapshots__/block-component.test.ts.snap index 5e5209e..878473c 100644 --- a/test/__snapshots__/block-component.test.ts.snap +++ b/test/__snapshots__/block-component.test.ts.snap @@ -47,6 +47,53 @@ exports[`block-component > component-attributes 1`] = ` } `; +exports[`block-component > component-attributes 2`] = ` +{ + "children": [ + { + "attributes": { + "key": "value", + }, + "children": [], + "data": { + "hName": "component", + "hProperties": { + "key": "value", + }, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 27, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 27, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + exports[`block-component > component-attributes-array-convert-double-quote 1`] = ` { "children": [ @@ -94,7 +141,7 @@ exports[`block-component > component-attributes-array-convert-double-quote 1`] = } `; -exports[`block-component > component-attributes-array-of-number 1`] = ` +exports[`block-component > component-attributes-array-convert-double-quote 2`] = ` { "children": [ { @@ -141,18 +188,18 @@ exports[`block-component > component-attributes-array-of-number 1`] = ` } `; -exports[`block-component > component-attributes-array-of-string 1`] = ` +exports[`block-component > component-attributes-array-of-number 1`] = ` { "children": [ { "attributes": { - ":items": "["Nuxt", "Vue"]", + ":items": "[1,2,3.5]", }, "children": [], "data": { "hName": "container-component", "hProperties": { - ":items": "["Nuxt", "Vue"]", + ":items": "[1,2,3.5]", }, }, "fmAttributes": {}, @@ -161,7 +208,7 @@ exports[`block-component > component-attributes-array-of-string 1`] = ` "end": { "column": 3, "line": 2, - "offset": 50, + "offset": 44, }, "start": { "column": 1, @@ -176,7 +223,7 @@ exports[`block-component > component-attributes-array-of-string 1`] = ` "end": { "column": 3, "line": 2, - "offset": 50, + "offset": 44, }, "start": { "column": 1, @@ -188,18 +235,18 @@ exports[`block-component > component-attributes-array-of-string 1`] = ` } `; -exports[`block-component > component-attributes-bad-array 1`] = ` +exports[`block-component > component-attributes-array-of-number 2`] = ` { "children": [ { "attributes": { - ":items": "[Nuxt,Vue]", + ":items": "[1,2,3.5]", }, "children": [], "data": { "hName": "container-component", "hProperties": { - ":items": "[Nuxt,Vue]", + ":items": "[1,2,3.5]", }, }, "fmAttributes": {}, @@ -208,7 +255,7 @@ exports[`block-component > component-attributes-bad-array 1`] = ` "end": { "column": 3, "line": 2, - "offset": 45, + "offset": 44, }, "start": { "column": 1, @@ -223,7 +270,7 @@ exports[`block-component > component-attributes-bad-array 1`] = ` "end": { "column": 3, "line": 2, - "offset": 45, + "offset": 44, }, "start": { "column": 1, @@ -235,27 +282,27 @@ exports[`block-component > component-attributes-bad-array 1`] = ` } `; -exports[`block-component > component-attributes-bind-frontmatter 1`] = ` +exports[`block-component > component-attributes-array-of-string 1`] = ` { "children": [ { "attributes": { - ":key": "value", + ":items": "["Nuxt", "Vue"]", }, "children": [], "data": { - "hName": "text-component", + "hName": "container-component", "hProperties": { - ":key": "value", + ":items": "["Nuxt", "Vue"]", }, }, "fmAttributes": {}, - "name": "text-component", + "name": "container-component", "position": { "end": { "column": 3, "line": 2, - "offset": 33, + "offset": 50, }, "start": { "column": 1, @@ -270,7 +317,7 @@ exports[`block-component > component-attributes-bind-frontmatter 1`] = ` "end": { "column": 3, "line": 2, - "offset": 33, + "offset": 50, }, "start": { "column": 1, @@ -282,27 +329,27 @@ exports[`block-component > component-attributes-bind-frontmatter 1`] = ` } `; -exports[`block-component > component-attributes-length-80 1`] = ` +exports[`block-component > component-attributes-array-of-string 2`] = ` { "children": [ { "attributes": { - "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ":items": "["Nuxt", "Vue"]", }, "children": [], "data": { - "hName": "component", + "hName": "container-component", "hProperties": { - "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ":items": "["Nuxt", "Vue"]", }, }, "fmAttributes": {}, - "name": "component", + "name": "container-component", "position": { "end": { "column": 3, "line": 2, - "offset": 83, + "offset": 50, }, "start": { "column": 1, @@ -317,7 +364,7 @@ exports[`block-component > component-attributes-length-80 1`] = ` "end": { "column": 3, "line": 2, - "offset": 83, + "offset": 50, }, "start": { "column": 1, @@ -329,27 +376,27 @@ exports[`block-component > component-attributes-length-80 1`] = ` } `; -exports[`block-component > component-attributes-length-81 1`] = ` +exports[`block-component > component-attributes-bad-array 1`] = ` { "children": [ { "attributes": { - "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ":items": "[Nuxt,Vue]", }, "children": [], "data": { - "hName": "component", + "hName": "container-component", "hProperties": { - "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ":items": "[Nuxt,Vue]", }, }, "fmAttributes": {}, - "name": "component", + "name": "container-component", "position": { "end": { "column": 3, "line": 2, - "offset": 84, + "offset": 45, }, "start": { "column": 1, @@ -364,7 +411,7 @@ exports[`block-component > component-attributes-length-81 1`] = ` "end": { "column": 3, "line": 2, - "offset": 84, + "offset": 45, }, "start": { "column": 1, @@ -376,18 +423,18 @@ exports[`block-component > component-attributes-length-81 1`] = ` } `; -exports[`block-component > component-attributes-object 1`] = ` +exports[`block-component > component-attributes-bad-array 2`] = ` { "children": [ { "attributes": { - ":items": "{"key": "value"}", + ":items": "[Nuxt,Vue]", }, "children": [], "data": { "hName": "container-component", "hProperties": { - ":items": "{"key": "value"}", + ":items": "[Nuxt,Vue]", }, }, "fmAttributes": {}, @@ -396,7 +443,7 @@ exports[`block-component > component-attributes-object 1`] = ` "end": { "column": 3, "line": 2, - "offset": 51, + "offset": 45, }, "start": { "column": 1, @@ -411,7 +458,7 @@ exports[`block-component > component-attributes-object 1`] = ` "end": { "column": 3, "line": 2, - "offset": 51, + "offset": 45, }, "start": { "column": 1, @@ -423,27 +470,27 @@ exports[`block-component > component-attributes-object 1`] = ` } `; -exports[`block-component > component-attributes-remove-duplicate 1`] = ` +exports[`block-component > component-attributes-bind-frontmatter 1`] = ` { "children": [ { "attributes": { - "key": "value", + ":key": "value", }, "children": [], "data": { - "hName": "component", + "hName": "text-component", "hProperties": { - "key": "value", + ":key": "value", }, }, "fmAttributes": {}, - "name": "component", + "name": "text-component", "position": { "end": { "column": 3, "line": 2, - "offset": 39, + "offset": 33, }, "start": { "column": 1, @@ -458,7 +505,7 @@ exports[`block-component > component-attributes-remove-duplicate 1`] = ` "end": { "column": 3, "line": 2, - "offset": 39, + "offset": 33, }, "start": { "column": 1, @@ -470,27 +517,27 @@ exports[`block-component > component-attributes-remove-duplicate 1`] = ` } `; -exports[`block-component > component-hProperties-be-the-same 1`] = ` +exports[`block-component > component-attributes-bind-frontmatter 2`] = ` { "children": [ { "attributes": { - ":items": "{"key":"value"}", + ":key": "value", }, "children": [], "data": { - "hName": "container-component", + "hName": "text-component", "hProperties": { - ":items": "{"key":"value"}", + ":key": "value", }, }, "fmAttributes": {}, - "name": "container-component", + "name": "text-component", "position": { "end": { "column": 3, "line": 2, - "offset": 50, + "offset": 33, }, "start": { "column": 1, @@ -500,45 +547,106 @@ exports[`block-component > component-hProperties-be-the-same 1`] = ` }, "type": "containerComponent", }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 33, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-attributes-length-80 1`] = ` +{ + "children": [ { - "attributes": {}, + "attributes": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, "children": [], "data": { - "hName": "container-component", + "hName": "component", "hProperties": { - ":items": "{"key":"value"}", + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", }, }, - "fmAttributes": { - "items": { - "key": "value", + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 83, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, }, }, - "name": "container-component", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 83, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-attributes-length-80 2`] = ` +{ + "children": [ + { + "attributes": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + "children": [], + "data": { + "hName": "component", + "hProperties": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + }, + "fmAttributes": {}, + "name": "component", "position": { "end": { "column": 3, - "line": 9, - "offset": 104, + "line": 2, + "offset": 83, }, "start": { "column": 1, - "line": 4, - "offset": 52, + "line": 1, + "offset": 0, }, }, - "rawData": " -items: - key: value ----", "type": "containerComponent", }, ], "position": { "end": { "column": 3, - "line": 9, - "offset": 104, + "line": 2, + "offset": 83, }, "start": { "column": 1, @@ -550,18 +658,18 @@ items: } `; -exports[`block-component > component-max-attributes-length-option 1`] = ` +exports[`block-component > component-attributes-length-81 1`] = ` { "children": [ { "attributes": { - "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", }, "children": [], "data": { "hName": "component", "hProperties": { - "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", }, }, "fmAttributes": {}, @@ -570,7 +678,7 @@ exports[`block-component > component-max-attributes-length-option 1`] = ` "end": { "column": 3, "line": 2, - "offset": 103, + "offset": 84, }, "start": { "column": 1, @@ -585,7 +693,7 @@ exports[`block-component > component-max-attributes-length-option 1`] = ` "end": { "column": 3, "line": 2, - "offset": 103, + "offset": 84, }, "start": { "column": 1, @@ -597,46 +705,2135 @@ exports[`block-component > component-max-attributes-length-option 1`] = ` } `; -exports[`block-component > dangling-list 1`] = ` +exports[`block-component > component-attributes-length-81 2`] = ` { "children": [ { - "attributes": {}, - "children": [ - { - "children": [ - { - "checked": null, - "children": [ - { - "children": [ - { + "attributes": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + "children": [], + "data": { + "hName": "component", + "hProperties": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 84, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 84, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-attributes-object 1`] = ` +{ + "children": [ + { + "attributes": { + ":items": "{"key": "value"}", + }, + "children": [], + "data": { + "hName": "container-component", + "hProperties": { + ":items": "{"key": "value"}", + }, + }, + "fmAttributes": {}, + "name": "container-component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 51, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 51, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-attributes-object 2`] = ` +{ + "children": [ + { + "attributes": { + ":items": "{"key": "value"}", + }, + "children": [], + "data": { + "hName": "container-component", + "hProperties": { + ":items": "{"key": "value"}", + }, + }, + "fmAttributes": {}, + "name": "container-component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 51, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 51, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-attributes-remove-duplicate 1`] = ` +{ + "children": [ + { + "attributes": { + "key": "value", + }, + "children": [], + "data": { + "hName": "component", + "hProperties": { + "key": "value", + }, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 39, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 39, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-attributes-remove-duplicate 2`] = ` +{ + "children": [ + { + "attributes": { + "key": "value", + }, + "children": [], + "data": { + "hName": "component", + "hProperties": { + "key": "value", + }, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 39, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 39, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-hProperties-be-the-same 1`] = ` +{ + "children": [ + { + "attributes": { + ":items": "{"key":"value"}", + }, + "children": [], + "data": { + "hName": "container-component", + "hProperties": { + ":items": "{"key":"value"}", + }, + }, + "fmAttributes": {}, + "name": "container-component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 50, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + { + "attributes": {}, + "children": [], + "data": { + "hName": "container-component", + "hProperties": { + ":items": "{"key":"value"}", + }, + }, + "fmAttributes": { + "items": { + "key": "value", + }, + }, + "name": "container-component", + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 104, + }, + "start": { + "column": 1, + "line": 4, + "offset": 52, + }, + }, + "rawData": " +items: + key: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 104, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-hProperties-be-the-same 2`] = ` +{ + "children": [ + { + "attributes": { + ":items": "{"key":"value"}", + }, + "children": [], + "data": { + "hName": "container-component", + "hProperties": { + ":items": "{"key":"value"}", + }, + }, + "fmAttributes": {}, + "name": "container-component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 50, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + { + "attributes": {}, + "children": [], + "data": { + "hName": "container-component", + "hProperties": { + ":items": "{"key":"value"}", + }, + }, + "fmAttributes": { + "items": { + "key": "value", + }, + }, + "name": "container-component", + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 104, + }, + "start": { + "column": 1, + "line": 4, + "offset": 52, + }, + }, + "rawData": " +items: + key: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 104, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-max-attributes-length-option 1`] = ` +{ + "children": [ + { + "attributes": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + "children": [], + "data": { + "hName": "component", + "hProperties": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 103, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 103, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > component-max-attributes-length-option 2`] = ` +{ + "children": [ + { + "attributes": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + "children": [], + "data": { + "hName": "component", + "hProperties": { + "a": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 103, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 103, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > dangling-list 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "checked": null, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 12, + "line": 2, + "offset": 23, + }, + "start": { + "column": 3, + "line": 2, + "offset": 14, + }, + }, + "type": "text", + "value": "list item", + }, + ], + "position": { + "end": { + "column": 12, + "line": 2, + "offset": 23, + }, + "start": { + "column": 3, + "line": 2, + "offset": 14, + }, + }, + "type": "paragraph", + }, + ], + "position": { + "end": { + "column": 12, + "line": 2, + "offset": 23, + }, + "start": { + "column": 1, + "line": 2, + "offset": 12, + }, + }, + "spread": false, + "type": "listItem", + }, + { + "checked": null, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 12, + "line": 3, + "offset": 35, + }, + "start": { + "column": 3, + "line": 3, + "offset": 26, + }, + }, + "type": "text", + "value": "list item", + }, + ], + "position": { + "end": { + "column": 12, + "line": 3, + "offset": 35, + }, + "start": { + "column": 3, + "line": 3, + "offset": 26, + }, + }, + "type": "paragraph", + }, + ], + "position": { + "end": { + "column": 6, + "line": 5, + "offset": 42, + }, + "start": { + "column": 1, + "line": 3, + "offset": 24, + }, + }, + "spread": true, + "type": "listItem", + }, + ], + "ordered": false, + "position": { + "end": { + "column": 6, + "line": 5, + "offset": 42, + }, + "start": { + "column": 1, + "line": 2, + "offset": 12, + }, + }, + "spread": false, + "start": null, + "type": "list", + }, + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 6, + "offset": 55, + }, + "start": { + "column": 1, + "line": 6, + "offset": 43, + }, + }, + "type": "text", + "value": "slot content", + }, + ], + "position": { + "end": { + "column": 13, + "line": 6, + "offset": 55, + }, + "start": { + "column": 1, + "line": 6, + "offset": 43, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:slot": "", + }, + }, + "name": "slot", + "position": { + "end": { + "column": 3, + "line": 7, + "offset": 58, + }, + "start": { + "column": 2, + "line": 5, + "offset": 38, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 7, + "offset": 58, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": undefined, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 7, + "offset": 58, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > dangling-list 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "checked": null, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 14, + "line": 2, + "offset": 25, + }, + "start": { + "column": 5, + "line": 2, + "offset": 16, + }, + }, + "type": "text", + "value": "list item", + }, + ], + "position": { + "end": { + "column": 14, + "line": 2, + "offset": 25, + }, + "start": { + "column": 5, + "line": 2, + "offset": 16, + }, + }, + "type": "paragraph", + }, + ], + "position": { + "end": { + "column": 14, + "line": 2, + "offset": 25, + }, + "start": { + "column": 3, + "line": 2, + "offset": 14, + }, + }, + "spread": false, + "type": "listItem", + }, + { + "checked": null, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 14, + "line": 3, + "offset": 39, + }, + "start": { + "column": 5, + "line": 3, + "offset": 30, + }, + }, + "type": "text", + "value": "list item", + }, + ], + "position": { + "end": { + "column": 14, + "line": 3, + "offset": 39, + }, + "start": { + "column": 5, + "line": 3, + "offset": 30, + }, + }, + "type": "paragraph", + }, + ], + "position": { + "end": { + "column": 6, + "line": 5, + "offset": 46, + }, + "start": { + "column": 3, + "line": 3, + "offset": 28, + }, + }, + "spread": true, + "type": "listItem", + }, + ], + "ordered": false, + "position": { + "end": { + "column": 6, + "line": 5, + "offset": 46, + }, + "start": { + "column": 3, + "line": 2, + "offset": 14, + }, + }, + "spread": false, + "start": null, + "type": "list", + }, + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 15, + "line": 6, + "offset": 61, + }, + "start": { + "column": 3, + "line": 6, + "offset": 49, + }, + }, + "type": "text", + "value": "slot content", + }, + ], + "position": { + "end": { + "column": 15, + "line": 6, + "offset": 61, + }, + "start": { + "column": 3, + "line": 6, + "offset": 49, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:slot": "", + }, + }, + "name": "slot", + "position": { + "end": { + "column": 3, + "line": 7, + "offset": 64, + }, + "start": { + "column": 2, + "line": 5, + "offset": 42, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 7, + "offset": 64, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": undefined, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 7, + "offset": 64, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > default-slot-attributes 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "attributes": { + "key": "value", + }, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 3, + "offset": 56, + }, + "start": { + "column": 1, + "line": 3, + "offset": 44, + }, + }, + "type": "text", + "value": "slot content", + }, + ], + "position": { + "end": { + "column": 13, + "line": 3, + "offset": 56, + }, + "start": { + "column": 1, + "line": 3, + "offset": 44, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "key": "value", + "v-slot:default": "", + }, + }, + "name": "default", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 59, + }, + "start": { + "column": 2, + "line": 2, + "offset": 23, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "container-component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "container-component", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 59, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 59, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > default-slot-attributes 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "attributes": { + "key": "value", + }, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 3, + "offset": 56, + }, + "start": { + "column": 1, + "line": 3, + "offset": 44, + }, + }, + "type": "text", + "value": "slot content", + }, + ], + "position": { + "end": { + "column": 13, + "line": 3, + "offset": 56, + }, + "start": { + "column": 1, + "line": 3, + "offset": 44, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "key": "value", + "v-slot:default": "", + }, + }, + "name": "default", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 59, + }, + "start": { + "column": 2, + "line": 2, + "offset": 23, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "container-component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "container-component", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 59, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 59, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > empty 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 14, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 14, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > empty 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 14, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 2, + "offset": 14, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > empty-slot 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:text": "", + }, + }, + "name": "text", + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 20, + }, + "start": { + "column": 2, + "line": 2, + "offset": 13, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 20, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 20, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > empty-slot 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:text": "", + }, + }, + "name": "text", + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 20, + }, + "start": { + "column": 2, + "line": 2, + "offset": 13, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 20, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 20, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > frontmatter 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter", + "hProperties": { + ":array": "["item",{"itemKey":"value"}]", + "key": "value", + }, + }, + "fmAttributes": { + "array": [ + "item", + { + "itemKey": "value", + }, + ], + "key": "value", + }, + "name": "with-frontmatter", + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 75, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": " +key: value +array: + - item + - itemKey: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 75, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > frontmatter 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter", + "hProperties": { + ":array": "["item",{"itemKey":"value"}]", + "key": "value", + }, + }, + "fmAttributes": { + "array": [ + "item", + { + "itemKey": "value", + }, + ], + "key": "value", + }, + "name": "with-frontmatter", + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 75, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": " +key: value +array: + - item + - itemKey: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 75, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > frontmatter-with-binding-variables 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter", + "hProperties": { + ":array": "["item",{":itemKey":"value"}]", + ":key": "value", + ":object": "{":subkey":"value","subkey2":"value"}", + }, + }, + "fmAttributes": { + ":key": "value", + "array": [ + "item", + { + ":itemKey": "value", + }, + ], + "object": { + ":subkey": "value", + "subkey2": "value", + }, + }, + "name": "with-frontmatter", + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 119, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": " +:key: value +array: + - item + - :itemKey: value +object: + :subkey: value + subkey2: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 119, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > frontmatter-with-binding-variables 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter", + "hProperties": { + ":array": "["item",{":itemKey":"value"}]", + ":key": "value", + ":object": "{":subkey":"value","subkey2":"value"}", + }, + }, + "fmAttributes": { + ":key": "value", + "array": [ + "item", + { + ":itemKey": "value", + }, + ], + "object": { + ":subkey": "value", + "subkey2": "value", + }, + }, + "name": "with-frontmatter", + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 119, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": " +:key: value +array: + - item + - :itemKey: value +object: + :subkey: value + subkey2: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 119, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > frontmatter1 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter", + "hProperties": { + ":array": "["item",{"itemKey":"value"}]", + ":key2": "{"subkey":"value","subkey2":"value"}", + "key": "value", + }, + }, + "fmAttributes": { + "array": [ + "item", + { + "itemKey": "value", + }, + ], + "key": "value", + "key2": { + "subkey": "value", + "subkey2": "value", + }, + }, + "name": "with-frontmatter", + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 114, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": " +key: value +key2: + subkey: value + subkey2: value +array: + - item + - itemKey: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 114, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > frontmatter1 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter", + "hProperties": { + ":array": "["item",{"itemKey":"value"}]", + ":key2": "{"subkey":"value","subkey2":"value"}", + "key": "value", + }, + }, + "fmAttributes": { + "array": [ + "item", + { + "itemKey": "value", + }, + ], + "key": "value", + "key2": { + "subkey": "value", + "subkey2": "value", + }, + }, + "name": "with-frontmatter", + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 114, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": " +key: value +key2: + subkey: value + subkey2: value +array: + - item + - itemKey: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 114, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > ignore-code-fence 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 11, + "line": 2, + "offset": 22, + }, + "start": { + "column": 1, + "line": 2, + "offset": 12, + }, + }, + "type": "text", + "value": "First line", + }, + ], + "position": { + "end": { + "column": 11, + "line": 2, + "offset": 22, + }, + "start": { + "column": 1, + "line": 2, + "offset": 12, + }, + }, + "type": "paragraph", + }, + { + "lang": "cpp", + "meta": null, + "position": { + "end": { + "column": 4, + "line": 6, + "offset": 54, + }, + "start": { + "column": 1, + "line": 4, + "offset": 24, + }, + }, + "type": "code", + "value": "#include ", + }, + { + "children": [ + { + "position": { + "end": { + "column": 12, + "line": 8, + "offset": 67, + }, + "start": { + "column": 1, + "line": 8, + "offset": 56, + }, + }, + "type": "text", + "value": "Second line", + }, + ], + "position": { + "end": { + "column": 12, + "line": 8, + "offset": 67, + }, + "start": { + "column": 1, + "line": 8, + "offset": 56, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 70, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + { + "children": [ + { + "position": { + "end": { + "column": 11, + "line": 11, + "offset": 82, + }, + "start": { + "column": 1, + "line": 11, + "offset": 72, + }, + }, + "type": "text", + "value": "Third line", + }, + ], + "position": { + "end": { + "column": 11, + "line": 11, + "offset": 82, + }, + "start": { + "column": 1, + "line": 11, + "offset": 72, + }, + }, + "type": "paragraph", + }, + ], + "position": { + "end": { + "column": 11, + "line": 11, + "offset": 82, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > ignore-code-fence 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 2, + "offset": 24, + }, + "start": { + "column": 3, + "line": 2, + "offset": 14, + }, + }, + "type": "text", + "value": "First line", + }, + ], + "position": { + "end": { + "column": 13, + "line": 2, + "offset": 24, + }, + "start": { + "column": 3, + "line": 2, + "offset": 14, + }, + }, + "type": "paragraph", + }, + { + "lang": "cpp", + "meta": null, + "position": { + "end": { + "column": 6, + "line": 6, + "offset": 62, + }, + "start": { + "column": 3, + "line": 4, + "offset": 28, + }, + }, + "type": "code", + "value": "#include ", + }, + { + "children": [ + { + "position": { + "end": { + "column": 14, + "line": 8, + "offset": 77, + }, + "start": { + "column": 3, + "line": 8, + "offset": 66, + }, + }, + "type": "text", + "value": "Second line", + }, + ], + "position": { + "end": { + "column": 14, + "line": 8, + "offset": 77, + }, + "start": { + "column": 3, + "line": 8, + "offset": 66, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 80, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + { + "children": [ + { + "position": { + "end": { + "column": 11, + "line": 11, + "offset": 92, + }, + "start": { + "column": 1, + "line": 11, + "offset": 82, + }, + }, + "type": "text", + "value": "Third line", + }, + ], + "position": { + "end": { + "column": 11, + "line": 11, + "offset": 92, + }, + "start": { + "column": 1, + "line": 11, + "offset": 82, + }, + }, + "type": "paragraph", + }, + ], + "position": { + "end": { + "column": 11, + "line": 11, + "offset": 92, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > indent-children 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "checked": null, + "children": [ + { + "children": [ + { "position": { "end": { - "column": 12, - "line": 2, - "offset": 23, + "column": 9, + "line": 3, + "offset": 19, }, "start": { "column": 3, - "line": 2, - "offset": 14, + "line": 3, + "offset": 13, }, }, "type": "text", - "value": "list item", + "value": "item 1", }, ], "position": { "end": { - "column": 12, - "line": 2, - "offset": 23, + "column": 9, + "line": 3, + "offset": 19, }, "start": { "column": 3, - "line": 2, - "offset": 14, + "line": 3, + "offset": 13, }, }, "type": "paragraph", @@ -644,14 +2841,14 @@ exports[`block-component > dangling-list 1`] = ` ], "position": { "end": { - "column": 12, - "line": 2, - "offset": 23, + "column": 9, + "line": 3, + "offset": 19, }, "start": { "column": 1, - "line": 2, - "offset": 12, + "line": 3, + "offset": 11, }, }, "spread": false, @@ -665,30 +2862,203 @@ exports[`block-component > dangling-list 1`] = ` { "position": { "end": { - "column": 12, + "column": 9, + "line": 4, + "offset": 28, + }, + "start": { + "column": 3, + "line": 4, + "offset": 22, + }, + }, + "type": "text", + "value": "item 2", + }, + ], + "position": { + "end": { + "column": 9, + "line": 4, + "offset": 28, + }, + "start": { + "column": 3, + "line": 4, + "offset": 22, + }, + }, + "type": "paragraph", + }, + ], + "position": { + "end": { + "column": 9, + "line": 4, + "offset": 28, + }, + "start": { + "column": 1, + "line": 4, + "offset": 20, + }, + }, + "spread": false, + "type": "listItem", + }, + ], + "ordered": false, + "position": { + "end": { + "column": 9, + "line": 4, + "offset": 28, + }, + "start": { + "column": 1, + "line": 3, + "offset": 11, + }, + }, + "spread": false, + "start": null, + "type": "list", + }, + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 10, + "line": 7, + "offset": 51, + }, + "start": { + "column": 1, + "line": 7, + "offset": 42, + }, + }, + "type": "text", + "value": "compoennt", + }, + ], + "position": { + "end": { + "column": 10, + "line": 7, + "offset": 51, + }, + "start": { + "column": 1, + "line": 7, + "offset": 42, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 54, + }, + "start": { + "column": 1, + "line": 6, + "offset": 30, + }, + }, + "type": "containerComponent", + }, + ], + "data": { + "hName": "parent", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "parent", + "position": { + "end": { + "column": 4, + "line": 10, + "offset": 59, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 4, + "line": 10, + "offset": 59, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > indent-children 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "checked": null, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 9, "line": 3, - "offset": 35, + "offset": 19, }, "start": { "column": 3, "line": 3, - "offset": 26, + "offset": 13, }, }, "type": "text", - "value": "list item", + "value": "item 1", }, ], "position": { "end": { - "column": 12, + "column": 9, "line": 3, - "offset": 35, + "offset": 19, }, "start": { "column": 3, "line": 3, - "offset": 26, + "offset": 13, }, }, "type": "paragraph", @@ -696,31 +3066,83 @@ exports[`block-component > dangling-list 1`] = ` ], "position": { "end": { - "column": 6, - "line": 5, - "offset": 42, + "column": 9, + "line": 3, + "offset": 19, }, "start": { "column": 1, "line": 3, - "offset": 24, + "offset": 11, }, }, - "spread": true, + "spread": false, + "type": "listItem", + }, + { + "checked": null, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 9, + "line": 4, + "offset": 28, + }, + "start": { + "column": 3, + "line": 4, + "offset": 22, + }, + }, + "type": "text", + "value": "item 2", + }, + ], + "position": { + "end": { + "column": 9, + "line": 4, + "offset": 28, + }, + "start": { + "column": 3, + "line": 4, + "offset": 22, + }, + }, + "type": "paragraph", + }, + ], + "position": { + "end": { + "column": 9, + "line": 4, + "offset": 28, + }, + "start": { + "column": 1, + "line": 4, + "offset": 20, + }, + }, + "spread": false, "type": "listItem", }, ], "ordered": false, "position": { "end": { - "column": 6, - "line": 5, - "offset": 42, + "column": 9, + "line": 4, + "offset": 28, }, "start": { "column": 1, - "line": 2, - "offset": 12, + "line": 3, + "offset": 11, }, }, "spread": false, @@ -735,68 +3157,67 @@ exports[`block-component > dangling-list 1`] = ` { "position": { "end": { - "column": 13, - "line": 6, - "offset": 55, + "column": 10, + "line": 7, + "offset": 51, }, "start": { "column": 1, - "line": 6, - "offset": 43, + "line": 7, + "offset": 42, }, }, "type": "text", - "value": "slot content", + "value": "compoennt", }, ], "position": { "end": { - "column": 13, - "line": 6, - "offset": 55, + "column": 10, + "line": 7, + "offset": 51, }, "start": { "column": 1, - "line": 6, - "offset": 43, + "line": 7, + "offset": 42, }, }, "type": "paragraph", }, ], "data": { - "hName": "component-slot", - "hProperties": { - "v-slot:slot": "", - }, + "hName": "component", + "hProperties": {}, }, - "name": "slot", + "fmAttributes": {}, + "name": "component", "position": { "end": { "column": 3, - "line": 7, - "offset": 58, + "line": 8, + "offset": 54, }, "start": { - "column": 2, - "line": 5, - "offset": 38, + "column": 1, + "line": 6, + "offset": 30, }, }, - "type": "componentContainerSection", + "type": "containerComponent", }, ], "data": { - "hName": "component", + "hName": "parent", "hProperties": {}, }, "fmAttributes": {}, - "name": "component", + "name": "parent", "position": { "end": { - "column": 3, - "line": 7, - "offset": 58, + "column": 4, + "line": 10, + "offset": 59, }, "start": { "column": 1, @@ -804,15 +3225,14 @@ exports[`block-component > dangling-list 1`] = ` "offset": 0, }, }, - "rawData": undefined, "type": "containerComponent", }, ], "position": { "end": { - "column": 3, - "line": 7, - "offset": 58, + "column": 4, + "line": 10, + "offset": 59, }, "start": { "column": 1, @@ -824,85 +3244,27 @@ exports[`block-component > dangling-list 1`] = ` } `; -exports[`block-component > default-slot-attributes 1`] = ` +exports[`block-component > jsonScapeAttr 1`] = ` { "children": [ { - "attributes": {}, - "children": [ - { - "attributes": { - "key": "value", - }, - "children": [ - { - "children": [ - { - "position": { - "end": { - "column": 13, - "line": 3, - "offset": 56, - }, - "start": { - "column": 1, - "line": 3, - "offset": 44, - }, - }, - "type": "text", - "value": "slot content", - }, - ], - "position": { - "end": { - "column": 13, - "line": 3, - "offset": 56, - }, - "start": { - "column": 1, - "line": 3, - "offset": 44, - }, - }, - "type": "paragraph", - }, - ], - "data": { - "hName": "component-slot", - "hProperties": { - "key": "value", - "v-slot:default": "", - }, - }, - "name": "default", - "position": { - "end": { - "column": 3, - "line": 4, - "offset": 59, - }, - "start": { - "column": 2, - "line": 2, - "offset": 23, - }, - }, - "type": "componentContainerSection", - }, - ], + "attributes": { + ":test": "{"foo":"I'd love to"}", + }, + "children": [], "data": { - "hName": "container-component", - "hProperties": {}, + "hName": "foo", + "hProperties": { + ":test": "{"foo":"I'd love to"}", + }, }, "fmAttributes": {}, - "name": "container-component", + "name": "foo", "position": { "end": { "column": 3, - "line": 4, - "offset": 59, + "line": 2, + "offset": 40, }, "start": { "column": 1, @@ -916,8 +3278,8 @@ exports[`block-component > default-slot-attributes 1`] = ` "position": { "end": { "column": 3, - "line": 4, - "offset": 59, + "line": 2, + "offset": 40, }, "start": { "column": 1, @@ -929,23 +3291,27 @@ exports[`block-component > default-slot-attributes 1`] = ` } `; -exports[`block-component > empty 1`] = ` +exports[`block-component > jsonScapeAttr 2`] = ` { "children": [ { - "attributes": {}, + "attributes": { + ":test": "{"foo":"I'd love to"}", + }, "children": [], "data": { - "hName": "component", - "hProperties": {}, + "hName": "foo", + "hProperties": { + ":test": "{"foo":"I'd love to"}", + }, }, "fmAttributes": {}, - "name": "component", + "name": "foo", "position": { "end": { "column": 3, "line": 2, - "offset": 14, + "offset": 40, }, "start": { "column": 1, @@ -960,7 +3326,7 @@ exports[`block-component > empty 1`] = ` "end": { "column": 3, "line": 2, - "offset": 14, + "offset": 40, }, "start": { "column": 1, @@ -972,82 +3338,136 @@ exports[`block-component > empty 1`] = ` } `; -exports[`block-component > empty-slot 1`] = ` +exports[`block-component > nested-component 1`] = ` { "children": [ { "attributes": {}, "children": [ { - "attributes": {}, - "children": [], - "data": { - "hName": "component-slot", - "hProperties": { - "v-slot:text": "", + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 8, + "offset": 106, + }, + "start": { + "column": 1, + "line": 8, + "offset": 94, + }, + }, + "type": "text", + "value": "Default slot", }, - }, - "name": "text", + ], "position": { "end": { - "column": 3, - "line": 3, - "offset": 20, + "column": 13, + "line": 8, + "offset": 106, }, "start": { - "column": 2, - "line": 2, - "offset": 13, + "column": 1, + "line": 8, + "offset": 94, }, }, - "type": "componentContainerSection", - }, - ], - "data": { - "hName": "component", - "hProperties": {}, - }, - "fmAttributes": {}, - "name": "component", - "position": { - "end": { - "column": 3, - "line": 3, - "offset": 20, + "type": "paragraph", }, - "start": { - "column": 1, - "line": 1, - "offset": 0, + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 21, + "line": 11, + "offset": 144, + }, + "start": { + "column": 1, + "line": 11, + "offset": 124, + }, + }, + "type": "text", + "value": "Secondary slot value", + }, + ], + "position": { + "end": { + "column": 21, + "line": 11, + "offset": 144, + }, + "start": { + "column": 1, + "line": 11, + "offset": 124, + }, + }, + "type": "paragraph", + }, + { + "attributes": {}, + "children": [], + "data": { + "hName": "hello", + "hProperties": { + "key": "value", + }, + }, + "fmAttributes": { + "key": "value", + }, + "name": "hello", + "position": { + "end": { + "column": 6, + "line": 17, + "offset": 187, + }, + "start": { + "column": 3, + "line": 13, + "offset": 148, + }, + }, + "rawData": " + key: value + ---", + "type": "containerComponent", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:secondary-slot": "", + }, + }, + "name": "secondary-slot", + "position": { + "end": { + "column": 3, + "line": 18, + "offset": 190, + }, + "start": { + "column": 2, + "line": 10, + "offset": 109, + }, + }, + "type": "componentContainerSection", }, - }, - "type": "containerComponent", - }, - ], - "position": { - "end": { - "column": 3, - "line": 3, - "offset": 20, - }, - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "type": "root", -} -`; - -exports[`block-component > frontmatter 1`] = ` -{ - "children": [ - { - "attributes": {}, - "children": [], + ], "data": { - "hName": "with-frontmatter", + "hName": "with-frontmatter-and-nested-component", "hProperties": { ":array": "["item",{"itemKey":"value"}]", "key": "value", @@ -1062,12 +3482,12 @@ exports[`block-component > frontmatter 1`] = ` ], "key": "value", }, - "name": "with-frontmatter", + "name": "with-frontmatter-and-nested-component", "position": { "end": { "column": 3, - "line": 8, - "offset": 75, + "line": 18, + "offset": 190, }, "start": { "column": 1, @@ -1087,8 +3507,8 @@ array: "position": { "end": { "column": 3, - "line": 8, - "offset": 75, + "line": 18, + "offset": 190, }, "start": { "column": 1, @@ -1100,85 +3520,138 @@ array: } `; -exports[`block-component > frontmatter-with-binding-variables 1`] = ` +exports[`block-component > nested-component 2`] = ` { "children": [ { "attributes": {}, - "children": [], - "data": { - "hName": "with-frontmatter", - "hProperties": { - ":array": "["item",{":itemKey":"value"}]", - ":key": "value", - ":object": "{":subkey":"value","subkey2":"value"}", - }, - }, - "fmAttributes": { - ":key": "value", - "array": [ - "item", - { - ":itemKey": "value", + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 8, + "offset": 106, + }, + "start": { + "column": 1, + "line": 8, + "offset": 94, + }, + }, + "type": "text", + "value": "Default slot", + }, + ], + "position": { + "end": { + "column": 13, + "line": 8, + "offset": 106, + }, + "start": { + "column": 1, + "line": 8, + "offset": 94, + }, }, - ], - "object": { - ":subkey": "value", - "subkey2": "value", - }, - }, - "name": "with-frontmatter", - "position": { - "end": { - "column": 3, - "line": 11, - "offset": 119, + "type": "paragraph", }, - "start": { - "column": 1, - "line": 1, - "offset": 0, + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 21, + "line": 11, + "offset": 144, + }, + "start": { + "column": 1, + "line": 11, + "offset": 124, + }, + }, + "type": "text", + "value": "Secondary slot value", + }, + ], + "position": { + "end": { + "column": 21, + "line": 11, + "offset": 144, + }, + "start": { + "column": 1, + "line": 11, + "offset": 124, + }, + }, + "type": "paragraph", + }, + { + "attributes": {}, + "children": [], + "data": { + "hName": "hello", + "hProperties": { + "key": "value", + }, + }, + "fmAttributes": { + "key": "value", + }, + "name": "hello", + "position": { + "end": { + "column": 6, + "line": 17, + "offset": 187, + }, + "start": { + "column": 3, + "line": 13, + "offset": 148, + }, + }, + "rawData": " + key: value + ---", + "type": "containerComponent", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:secondary-slot": "", + }, + }, + "name": "secondary-slot", + "position": { + "end": { + "column": 3, + "line": 18, + "offset": 190, + }, + "start": { + "column": 2, + "line": 10, + "offset": 109, + }, + }, + "type": "componentContainerSection", }, - }, - "rawData": " -:key: value -array: - - item - - :itemKey: value -object: - :subkey: value - subkey2: value ----", - "type": "containerComponent", - }, - ], - "position": { - "end": { - "column": 3, - "line": 11, - "offset": 119, - }, - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "type": "root", -} -`; - -exports[`block-component > frontmatter1 1`] = ` -{ - "children": [ - { - "attributes": {}, - "children": [], + ], "data": { - "hName": "with-frontmatter", + "hName": "with-frontmatter-and-nested-component", "hProperties": { ":array": "["item",{"itemKey":"value"}]", - ":key2": "{"subkey":"value","subkey2":"value"}", "key": "value", }, }, @@ -1190,17 +3663,13 @@ exports[`block-component > frontmatter1 1`] = ` }, ], "key": "value", - "key2": { - "subkey": "value", - "subkey2": "value", - }, }, - "name": "with-frontmatter", + "name": "with-frontmatter-and-nested-component", "position": { "end": { "column": 3, - "line": 11, - "offset": 114, + "line": 18, + "offset": 190, }, "start": { "column": 1, @@ -1209,10 +3678,7 @@ exports[`block-component > frontmatter1 1`] = ` }, }, "rawData": " -key: value -key2: - subkey: value - subkey2: value +key: value array: - item - itemKey: value @@ -1223,8 +3689,8 @@ array: "position": { "end": { "column": 3, - "line": 11, - "offset": 114, + "line": 18, + "offset": 190, }, "start": { "column": 1, @@ -1236,188 +3702,239 @@ array: } `; -exports[`block-component > ignore-code-fence 1`] = ` +exports[`block-component > section-order 1`] = ` { "children": [ { "attributes": {}, "children": [ { + "attributes": {}, "children": [ { + "children": [ + { + "position": { + "end": { + "column": 6, + "line": 3, + "offset": 19, + }, + "start": { + "column": 1, + "line": 3, + "offset": 14, + }, + }, + "type": "text", + "value": "Hello", + }, + ], "position": { "end": { - "column": 11, - "line": 2, - "offset": 22, + "column": 6, + "line": 3, + "offset": 19, }, "start": { "column": 1, - "line": 2, - "offset": 12, + "line": 3, + "offset": 14, }, }, - "type": "text", - "value": "First line", + "type": "paragraph", }, ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:title": "", + }, + }, + "name": "title", "position": { "end": { - "column": 11, - "line": 2, - "offset": 22, + "column": 1, + "line": 4, + "offset": 20, }, "start": { - "column": 1, + "column": 2, "line": 2, - "offset": 12, + "offset": 8, }, }, - "type": "paragraph", + "type": "componentContainerSection", }, { - "lang": "cpp", - "meta": null, + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 6, + "line": 5, + "offset": 40, + }, + "start": { + "column": 1, + "line": 5, + "offset": 35, + }, + }, + "type": "text", + "value": "World", + }, + ], + "position": { + "end": { + "column": 6, + "line": 5, + "offset": 40, + }, + "start": { + "column": 1, + "line": 5, + "offset": 35, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:another-title": "", + }, + }, + "name": "another-title", "position": { "end": { - "column": 4, + "column": 1, "line": 6, - "offset": 54, + "offset": 41, }, "start": { - "column": 1, + "column": 2, "line": 4, - "offset": 24, + "offset": 21, }, }, - "type": "code", - "value": "#include ", + "type": "componentContainerSection", }, { "children": [ { "position": { "end": { - "column": 12, - "line": 8, - "offset": 67, + "column": 3, + "line": 7, + "offset": 52, }, "start": { "column": 1, - "line": 8, - "offset": 56, + "line": 7, + "offset": 50, }, }, "type": "text", - "value": "Second line", + "value": "P1", }, ], "position": { "end": { - "column": 12, - "line": 8, - "offset": 67, + "column": 3, + "line": 7, + "offset": 52, }, "start": { "column": 1, - "line": 8, - "offset": 56, + "line": 7, + "offset": 50, }, }, "type": "paragraph", }, - ], - "data": { - "hName": "component", - "hProperties": {}, - }, - "fmAttributes": {}, - "name": "component", - "position": { - "end": { - "column": 3, - "line": 9, - "offset": 70, - }, - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "type": "containerComponent", - }, - { - "children": [ { + "children": [ + { + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 56, + }, + "start": { + "column": 1, + "line": 9, + "offset": 54, + }, + }, + "type": "text", + "value": "P2", + }, + ], "position": { "end": { - "column": 11, - "line": 11, - "offset": 82, + "column": 3, + "line": 9, + "offset": 56, }, "start": { "column": 1, - "line": 11, - "offset": 72, + "line": 9, + "offset": 54, }, }, - "type": "text", - "value": "Third line", - }, - ], - "position": { - "end": { - "column": 11, - "line": 11, - "offset": 82, - }, - "start": { - "column": 1, - "line": 11, - "offset": 72, + "type": "paragraph", }, - }, - "type": "paragraph", - }, - ], - "position": { - "end": { - "column": 11, - "line": 11, - "offset": 82, - }, - "start": { - "column": 1, - "line": 1, - "offset": 0, - }, - }, - "type": "root", -} -`; - -exports[`block-component > jsonScapeAttr 1`] = ` -{ - "children": [ - { - "attributes": { - ":test": "{"foo":"I'd love to"}", - }, - "children": [], - "data": { - "hName": "foo", - "hProperties": { - ":test": "{"foo":"I'd love to"}", + { + "children": [ + { + "position": { + "end": { + "column": 2, + "line": 11, + "offset": 59, + }, + "start": { + "column": 1, + "line": 11, + "offset": 58, + }, + }, + "type": "text", + "value": "P", + }, + ], + "position": { + "end": { + "column": 2, + "line": 11, + "offset": 59, + }, + "start": { + "column": 1, + "line": 11, + "offset": 58, + }, + }, + "type": "paragraph", }, + ], + "data": { + "hName": "comp", + "hProperties": {}, }, "fmAttributes": {}, - "name": "foo", + "name": "comp", "position": { "end": { "column": 3, - "line": 2, - "offset": 40, + "line": 12, + "offset": 62, }, "start": { "column": 1, @@ -1425,14 +3942,15 @@ exports[`block-component > jsonScapeAttr 1`] = ` "offset": 0, }, }, + "rawData": undefined, "type": "containerComponent", }, ], "position": { "end": { "column": 3, - "line": 2, - "offset": 40, + "line": 12, + "offset": 62, }, "start": { "column": 1, @@ -1444,44 +3962,69 @@ exports[`block-component > jsonScapeAttr 1`] = ` } `; -exports[`block-component > nested-component 1`] = ` +exports[`block-component > section-order 2`] = ` { "children": [ { "attributes": {}, "children": [ { + "attributes": {}, "children": [ { + "children": [ + { + "position": { + "end": { + "column": 6, + "line": 3, + "offset": 19, + }, + "start": { + "column": 1, + "line": 3, + "offset": 14, + }, + }, + "type": "text", + "value": "Hello", + }, + ], "position": { "end": { - "column": 13, - "line": 8, - "offset": 106, + "column": 6, + "line": 3, + "offset": 19, }, "start": { "column": 1, - "line": 8, - "offset": 94, + "line": 3, + "offset": 14, }, }, - "type": "text", - "value": "Default slot", + "type": "paragraph", }, ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:title": "", + }, + }, + "name": "title", "position": { "end": { - "column": 13, - "line": 8, - "offset": 106, + "column": 1, + "line": 4, + "offset": 20, }, "start": { - "column": 1, - "line": 8, - "offset": 94, + "column": 2, + "line": 2, + "offset": 8, }, }, - "type": "paragraph", + "type": "componentContainerSection", }, { "attributes": {}, @@ -1491,109 +4034,167 @@ exports[`block-component > nested-component 1`] = ` { "position": { "end": { - "column": 21, - "line": 11, - "offset": 144, + "column": 6, + "line": 5, + "offset": 40, }, "start": { "column": 1, - "line": 11, - "offset": 124, + "line": 5, + "offset": 35, }, }, "type": "text", - "value": "Secondary slot value", + "value": "World", }, ], "position": { "end": { - "column": 21, - "line": 11, - "offset": 144, + "column": 6, + "line": 5, + "offset": 40, }, "start": { "column": 1, - "line": 11, - "offset": 124, + "line": 5, + "offset": 35, }, }, "type": "paragraph", }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:another-title": "", + }, + }, + "name": "another-title", + "position": { + "end": { + "column": 1, + "line": 6, + "offset": 41, + }, + "start": { + "column": 2, + "line": 4, + "offset": 21, + }, + }, + "type": "componentContainerSection", + }, + { + "children": [ { - "attributes": {}, - "children": [], - "data": { - "hName": "hello", - "hProperties": { - "key": "value", - }, - }, - "fmAttributes": { - "key": "value", - }, - "name": "hello", "position": { "end": { - "column": 6, - "line": 17, - "offset": 187, + "column": 3, + "line": 7, + "offset": 52, }, "start": { - "column": 3, - "line": 13, - "offset": 148, + "column": 1, + "line": 7, + "offset": 50, }, }, - "rawData": " - key: value - ---", - "type": "containerComponent", + "type": "text", + "value": "P1", }, ], - "data": { - "hName": "component-slot", - "hProperties": { - "v-slot:secondary-slot": "", + "position": { + "end": { + "column": 3, + "line": 7, + "offset": 52, + }, + "start": { + "column": 1, + "line": 7, + "offset": 50, }, }, - "name": "secondary-slot", + "type": "paragraph", + }, + { + "children": [ + { + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 56, + }, + "start": { + "column": 1, + "line": 9, + "offset": 54, + }, + }, + "type": "text", + "value": "P2", + }, + ], "position": { "end": { "column": 3, - "line": 18, - "offset": 190, + "line": 9, + "offset": 56, }, "start": { + "column": 1, + "line": 9, + "offset": 54, + }, + }, + "type": "paragraph", + }, + { + "children": [ + { + "position": { + "end": { + "column": 2, + "line": 11, + "offset": 59, + }, + "start": { + "column": 1, + "line": 11, + "offset": 58, + }, + }, + "type": "text", + "value": "P", + }, + ], + "position": { + "end": { "column": 2, - "line": 10, - "offset": 109, + "line": 11, + "offset": 59, + }, + "start": { + "column": 1, + "line": 11, + "offset": 58, }, }, - "type": "componentContainerSection", + "type": "paragraph", }, ], "data": { - "hName": "with-frontmatter-and-nested-component", - "hProperties": { - ":array": "["item",{"itemKey":"value"}]", - "key": "value", - }, - }, - "fmAttributes": { - "array": [ - "item", - { - "itemKey": "value", - }, - ], - "key": "value", + "hName": "comp", + "hProperties": {}, }, - "name": "with-frontmatter-and-nested-component", + "fmAttributes": {}, + "name": "comp", "position": { "end": { "column": 3, - "line": 18, - "offset": 190, + "line": 12, + "offset": 62, }, "start": { "column": 1, @@ -1601,20 +4202,15 @@ exports[`block-component > nested-component 1`] = ` "offset": 0, }, }, - "rawData": " -key: value -array: - - item - - itemKey: value ----", + "rawData": undefined, "type": "containerComponent", }, ], "position": { "end": { "column": 3, - "line": 18, - "offset": 190, + "line": 12, + "offset": 62, }, "start": { "column": 1, @@ -1626,7 +4222,7 @@ array: } `; -exports[`block-component > section-order 1`] = ` +exports[`block-component > section-order-2 1`] = ` { "children": [ { @@ -1640,30 +4236,30 @@ exports[`block-component > section-order 1`] = ` { "position": { "end": { - "column": 6, + "column": 2, "line": 3, - "offset": 19, + "offset": 11, }, "start": { "column": 1, "line": 3, - "offset": 14, + "offset": 10, }, }, "type": "text", - "value": "Hello", + "value": "A", }, ], "position": { "end": { - "column": 6, + "column": 2, "line": 3, - "offset": 19, + "offset": 11, }, "start": { "column": 1, "line": 3, - "offset": 14, + "offset": 10, }, }, "type": "paragraph", @@ -1672,15 +4268,15 @@ exports[`block-component > section-order 1`] = ` "data": { "hName": "component-slot", "hProperties": { - "v-slot:title": "", + "v-slot:a": "", }, }, - "name": "title", + "name": "a", "position": { "end": { "column": 1, "line": 4, - "offset": 20, + "offset": 12, }, "start": { "column": 2, @@ -1698,30 +4294,30 @@ exports[`block-component > section-order 1`] = ` { "position": { "end": { - "column": 6, + "column": 2, "line": 5, - "offset": 40, + "offset": 16, }, "start": { "column": 1, "line": 5, - "offset": 35, + "offset": 15, }, }, "type": "text", - "value": "World", + "value": "C", }, ], "position": { "end": { - "column": 6, + "column": 2, "line": 5, - "offset": 40, + "offset": 16, }, "start": { "column": 1, "line": 5, - "offset": 35, + "offset": 15, }, }, "type": "paragraph", @@ -1730,56 +4326,81 @@ exports[`block-component > section-order 1`] = ` "data": { "hName": "component-slot", "hProperties": { - "v-slot:another-title": "", + "v-slot:c": "", }, }, - "name": "another-title", + "name": "c", "position": { "end": { "column": 1, "line": 6, - "offset": 41, + "offset": 17, }, "start": { "column": 2, "line": 4, - "offset": 21, + "offset": 13, }, }, "type": "componentContainerSection", }, { + "attributes": {}, "children": [ { + "children": [ + { + "position": { + "end": { + "column": 2, + "line": 7, + "offset": 21, + }, + "start": { + "column": 1, + "line": 7, + "offset": 20, + }, + }, + "type": "text", + "value": "B", + }, + ], "position": { "end": { - "column": 3, + "column": 2, "line": 7, - "offset": 52, + "offset": 21, }, "start": { "column": 1, "line": 7, - "offset": 50, + "offset": 20, }, }, - "type": "text", - "value": "P1", + "type": "paragraph", }, ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:b": "", + }, + }, + "name": "b", "position": { "end": { - "column": 3, - "line": 7, - "offset": 52, + "column": 1, + "line": 8, + "offset": 22, }, "start": { - "column": 1, - "line": 7, - "offset": 50, + "column": 2, + "line": 6, + "offset": 18, }, }, - "type": "paragraph", + "type": "componentContainerSection", }, { "children": [ @@ -1788,61 +4409,28 @@ exports[`block-component > section-order 1`] = ` "end": { "column": 3, "line": 9, - "offset": 56, + "offset": 33, }, "start": { "column": 1, "line": 9, - "offset": 54, + "offset": 31, }, }, "type": "text", - "value": "P2", + "value": "P1", }, ], "position": { "end": { "column": 3, "line": 9, - "offset": 56, + "offset": 33, }, "start": { "column": 1, "line": 9, - "offset": 54, - }, - }, - "type": "paragraph", - }, - { - "children": [ - { - "position": { - "end": { - "column": 2, - "line": 11, - "offset": 59, - }, - "start": { - "column": 1, - "line": 11, - "offset": 58, - }, - }, - "type": "text", - "value": "P", - }, - ], - "position": { - "end": { - "column": 2, - "line": 11, - "offset": 59, - }, - "start": { - "column": 1, - "line": 11, - "offset": 58, + "offset": 31, }, }, "type": "paragraph", @@ -1857,8 +4445,8 @@ exports[`block-component > section-order 1`] = ` "position": { "end": { "column": 3, - "line": 12, - "offset": 62, + "line": 10, + "offset": 36, }, "start": { "column": 1, @@ -1873,8 +4461,8 @@ exports[`block-component > section-order 1`] = ` "position": { "end": { "column": 3, - "line": 12, - "offset": 62, + "line": 10, + "offset": 36, }, "start": { "column": 1, @@ -1886,7 +4474,7 @@ exports[`block-component > section-order 1`] = ` } `; -exports[`block-component > section-order-2 1`] = ` +exports[`block-component > section-order-2 2`] = ` { "children": [ { @@ -2081,36 +4669,142 @@ exports[`block-component > section-order-2 1`] = ` "offset": 31, }, }, - "type": "text", - "value": "P1", + "type": "text", + "value": "P1", + }, + ], + "position": { + "end": { + "column": 3, + "line": 9, + "offset": 33, + }, + "start": { + "column": 1, + "line": 9, + "offset": 31, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "comp", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "comp", + "position": { + "end": { + "column": 3, + "line": 10, + "offset": 36, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": undefined, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 10, + "offset": 36, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`block-component > slot-attributes 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "attributes": { + "key": "value", + }, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 3, + "offset": 53, + }, + "start": { + "column": 1, + "line": 3, + "offset": 41, + }, + }, + "type": "text", + "value": "slot content", + }, + ], + "position": { + "end": { + "column": 13, + "line": 3, + "offset": 53, + }, + "start": { + "column": 1, + "line": 3, + "offset": 41, + }, + }, + "type": "paragraph", }, ], + "data": { + "hName": "component-slot", + "hProperties": { + "key": "value", + "v-slot:slot": "", + }, + }, + "name": "slot", "position": { "end": { "column": 3, - "line": 9, - "offset": 33, + "line": 4, + "offset": 56, }, "start": { - "column": 1, - "line": 9, - "offset": 31, + "column": 2, + "line": 2, + "offset": 23, }, }, - "type": "paragraph", + "type": "componentContainerSection", }, ], "data": { - "hName": "comp", + "hName": "container-component", "hProperties": {}, }, "fmAttributes": {}, - "name": "comp", + "name": "container-component", "position": { "end": { "column": 3, - "line": 10, - "offset": 36, + "line": 4, + "offset": 56, }, "start": { "column": 1, @@ -2118,15 +4812,14 @@ exports[`block-component > section-order-2 1`] = ` "offset": 0, }, }, - "rawData": undefined, "type": "containerComponent", }, ], "position": { "end": { "column": 3, - "line": 10, - "offset": 36, + "line": 4, + "offset": 56, }, "start": { "column": 1, @@ -2138,7 +4831,7 @@ exports[`block-component > section-order-2 1`] = ` } `; -exports[`block-component > slot-attributes 1`] = ` +exports[`block-component > slot-attributes 2`] = ` { "children": [ { @@ -2286,6 +4979,49 @@ exports[`block-component > sugar-syntax 1`] = ` } `; +exports[`block-component > sugar-syntax 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 11, + "line": 1, + "offset": 10, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "textComponent", + }, + ], + "position": { + "end": { + "column": 11, + "line": 1, + "offset": 10, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + exports[`block-component > text 1`] = ` { "children": [ @@ -2363,6 +5099,83 @@ exports[`block-component > text 1`] = ` } `; +exports[`block-component > text 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 5, + "line": 2, + "offset": 16, + }, + "start": { + "column": 1, + "line": 2, + "offset": 12, + }, + }, + "type": "text", + "value": "text", + }, + ], + "position": { + "end": { + "column": 5, + "line": 2, + "offset": 16, + }, + "start": { + "column": 1, + "line": 2, + "offset": 12, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 19, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 19, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + exports[`block-component > trim-slot-name 1`] = ` { "children": [ @@ -2464,3 +5277,105 @@ exports[`block-component > trim-slot-name 1`] = ` "type": "root", } `; + +exports[`block-component > trim-slot-name 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 3, + "offset": 31, + }, + "start": { + "column": 1, + "line": 3, + "offset": 19, + }, + }, + "type": "text", + "value": "slot content", + }, + ], + "position": { + "end": { + "column": 13, + "line": 3, + "offset": 31, + }, + "start": { + "column": 1, + "line": 3, + "offset": 19, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:slot": "", + }, + }, + "name": "slot", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 34, + }, + "start": { + "column": 2, + "line": 2, + "offset": 13, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "component", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 34, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 34, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; diff --git a/test/__snapshots__/codeblock-props.test.ts.snap b/test/__snapshots__/codeblock-props.test.ts.snap index f399476..01acce0 100644 --- a/test/__snapshots__/codeblock-props.test.ts.snap +++ b/test/__snapshots__/codeblock-props.test.ts.snap @@ -61,6 +61,67 @@ key: value", } `; +exports[`codeblock-props > YamlProps 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter-yaml", + "hProperties": { + ":array": "["item",{"itemKey":"value"}]", + "key": "value", + }, + }, + "fmAttributes": { + "array": [ + "item", + { + "itemKey": "value", + }, + ], + "key": "value", + }, + "mdc": { + "codeBlockProps": true, + }, + "name": "with-frontmatter-yaml", + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 92, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": "array: + - item + - itemKey: value +key: value", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 92, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + exports[`codeblock-props > nested-component-yamlProps 1`] = ` { "children": [ @@ -154,14 +215,198 @@ exports[`codeblock-props > nested-component-yamlProps 1`] = ` "name": "hello", "position": { "end": { - "column": 6, + "column": 4, + "line": 17, + "offset": 206, + }, + "start": { + "column": 1, + "line": 13, + "offset": 163, + }, + }, + "rawData": "key: value", + "type": "containerComponent", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:secondary-slot": "", + }, + }, + "name": "secondary-slot", + "position": { + "end": { + "column": 3, + "line": 18, + "offset": 209, + }, + "start": { + "column": 2, + "line": 10, + "offset": 126, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "with-frontmatter-and-nested-component-yaml", + "hProperties": { + ":array": "["item",{"itemKey":"value"}]", + "key": "value", + }, + }, + "fmAttributes": { + "array": [ + "item", + { + "itemKey": "value", + }, + ], + "key": "value", + }, + "mdc": { + "codeBlockProps": true, + }, + "name": "with-frontmatter-and-nested-component-yaml", + "position": { + "end": { + "column": 3, + "line": 18, + "offset": 209, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": "array: + - item + - itemKey: value +key: value", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 18, + "offset": 209, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`codeblock-props > nested-component-yamlProps 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 13, + "line": 8, + "offset": 123, + }, + "start": { + "column": 1, + "line": 8, + "offset": 111, + }, + }, + "type": "text", + "value": "Default slot", + }, + ], + "position": { + "end": { + "column": 13, + "line": 8, + "offset": 123, + }, + "start": { + "column": 1, + "line": 8, + "offset": 111, + }, + }, + "type": "paragraph", + }, + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 21, + "line": 11, + "offset": 161, + }, + "start": { + "column": 1, + "line": 11, + "offset": 141, + }, + }, + "type": "text", + "value": "Secondary slot value", + }, + ], + "position": { + "end": { + "column": 21, + "line": 11, + "offset": 161, + }, + "start": { + "column": 1, + "line": 11, + "offset": 141, + }, + }, + "type": "paragraph", + }, + { + "attributes": {}, + "children": [], + "data": { + "hName": "hello", + "hProperties": { + "key": "value", + }, + }, + "fmAttributes": { + "key": "value", + }, + "mdc": { + "codeBlockProps": true, + }, + "name": "hello", + "position": { + "end": { + "column": 4, "line": 17, - "offset": 216, + "offset": 206, }, "start": { - "column": 3, + "column": 1, "line": 13, - "offset": 165, + "offset": 163, }, }, "rawData": "key: value", @@ -179,7 +424,7 @@ exports[`codeblock-props > nested-component-yamlProps 1`] = ` "end": { "column": 3, "line": 18, - "offset": 219, + "offset": 209, }, "start": { "column": 2, @@ -214,7 +459,7 @@ exports[`codeblock-props > nested-component-yamlProps 1`] = ` "end": { "column": 3, "line": 18, - "offset": 219, + "offset": 209, }, "start": { "column": 1, @@ -233,7 +478,7 @@ key: value", "end": { "column": 3, "line": 18, - "offset": 219, + "offset": 209, }, "start": { "column": 1, @@ -310,25 +555,25 @@ array: } `; -exports[`codeblock-props > notYamlProps2 1`] = ` +exports[`codeblock-props > notYamlProps 2`] = ` { "children": [ { "attributes": {}, "children": [ { - "lang": "yaml[props]", + "lang": "yaml", "meta": null, "position": { "end": { - "column": 4, + "column": 6, "line": 7, - "offset": 88, + "offset": 93, }, "start": { - "column": 1, + "column": 3, "line": 2, - "offset": 24, + "offset": 26, }, }, "type": "code", @@ -348,7 +593,7 @@ array: "end": { "column": 3, "line": 8, - "offset": 91, + "offset": 96, }, "start": { "column": 1, @@ -363,7 +608,7 @@ array: "end": { "column": 3, "line": 8, - "offset": 91, + "offset": 96, }, "start": { "column": 1, @@ -375,15 +620,15 @@ array: } `; -exports[`codeblock-props > notYamlProps3 1`] = ` +exports[`codeblock-props > notYamlProps2 1`] = ` { "children": [ { "attributes": {}, "children": [ { - "lang": "yaml", - "meta": "[yaml]", + "lang": "yaml[props]", + "meta": null, "position": { "end": { "column": 4, @@ -440,12 +685,267 @@ array: } `; -exports[`codeblock-props > shouldConvertYamlProps 1`] = ` +exports[`codeblock-props > notYamlProps2 2`] = ` { "children": [ { "attributes": {}, - "children": [], + "children": [ + { + "lang": "yaml[props]", + "meta": null, + "position": { + "end": { + "column": 6, + "line": 7, + "offset": 100, + }, + "start": { + "column": 3, + "line": 2, + "offset": 26, + }, + }, + "type": "code", + "value": "key: value +array: + - item + - itemKey: value", + }, + ], + "data": { + "hName": "with-frontmatter-yaml", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "with-frontmatter-yaml", + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 103, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 103, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`codeblock-props > notYamlProps3 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "lang": "yaml", + "meta": "[yaml]", + "position": { + "end": { + "column": 4, + "line": 7, + "offset": 88, + }, + "start": { + "column": 1, + "line": 2, + "offset": 24, + }, + }, + "type": "code", + "value": "key: value +array: + - item + - itemKey: value", + }, + ], + "data": { + "hName": "with-frontmatter-yaml", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "with-frontmatter-yaml", + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 91, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 91, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`codeblock-props > notYamlProps3 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "lang": "yaml", + "meta": "[yaml]", + "position": { + "end": { + "column": 6, + "line": 7, + "offset": 100, + }, + "start": { + "column": 3, + "line": 2, + "offset": 26, + }, + }, + "type": "code", + "value": "key: value +array: + - item + - itemKey: value", + }, + ], + "data": { + "hName": "with-frontmatter-yaml", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "with-frontmatter-yaml", + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 103, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 103, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`codeblock-props > shouldConvertYamlProps 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter-yaml", + "hProperties": { + ":array": "["item",{"itemKey":"value"}]", + "key": "value", + }, + }, + "fmAttributes": { + "array": [ + "item", + { + "itemKey": "value", + }, + ], + "key": "value", + }, + "name": "with-frontmatter-yaml", + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 80, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": " +array: + - item + - itemKey: value +key: value +---", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 8, + "offset": 80, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`codeblock-props > shouldConvertYamlProps 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], "data": { "hName": "with-frontmatter-yaml", "hProperties": { @@ -568,3 +1068,72 @@ array: "type": "root", } `; + +exports[`codeblock-props > yamlProps1 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "with-frontmatter-yaml1", + "hProperties": { + ":array": "["item",{"itemKey":"value"}]", + ":key2": "{"subkey":"value","subkey2":"value"}", + "key": "value", + }, + }, + "fmAttributes": { + "array": [ + "item", + { + "itemKey": "value", + }, + ], + "key": "value", + "key2": { + "subkey": "value", + "subkey2": "value", + }, + }, + "mdc": { + "codeBlockProps": true, + }, + "name": "with-frontmatter-yaml1", + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 132, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": "key: value +key2: + subkey: value + subkey2: value +array: + - item + - itemKey: value", + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 11, + "offset": 132, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; diff --git a/test/__snapshots__/unwrap.test.ts.snap b/test/__snapshots__/unwrap.test.ts.snap index 6294382..30abf56 100644 --- a/test/__snapshots__/unwrap.test.ts.snap +++ b/test/__snapshots__/unwrap.test.ts.snap @@ -1,6 +1,73 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`auto-unwrap > componentChildren 1`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "attributes": {}, + "children": [], + "data": { + "hName": "another-component", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "another-component", + "position": { + "end": { + "column": 4, + "line": 3, + "offset": 31, + }, + "start": { + "column": 1, + "line": 2, + "offset": 7, + }, + }, + "type": "containerComponent", + }, + ], + "data": { + "hName": "test", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "test", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 34, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 34, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + +exports[`auto-unwrap > componentChildren 2`] = ` { "children": [ { @@ -130,6 +197,69 @@ exports[`auto-unwrap > simple 1`] = ` } `; +exports[`auto-unwrap > simple 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "position": { + "end": { + "column": 14, + "line": 2, + "offset": 20, + }, + "start": { + "column": 3, + "line": 2, + "offset": 9, + }, + }, + "type": "text", + "value": "Hello World", + }, + ], + "data": { + "hName": "test", + "hProperties": {}, + }, + "fmAttributes": {}, + "mdc": { + "unwrapped": "paragraph", + }, + "name": "test", + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 23, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 3, + "offset": 23, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + exports[`auto-unwrap > slot 1`] = ` { "children": [ @@ -218,6 +348,94 @@ exports[`auto-unwrap > slot 1`] = ` } `; +exports[`auto-unwrap > slot 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "attributes": {}, + "children": [ + { + "position": { + "end": { + "column": 14, + "line": 3, + "offset": 27, + }, + "start": { + "column": 3, + "line": 3, + "offset": 16, + }, + }, + "type": "text", + "value": "Hello World", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:title": "", + }, + }, + "mdc": { + "unwrapped": "paragraph", + }, + "name": "title", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 30, + }, + "start": { + "column": 2, + "line": 2, + "offset": 8, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "test", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "test", + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 30, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 4, + "offset": 30, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + exports[`auto-unwrap > twoChildren 1`] = ` { "children": [ @@ -328,6 +546,116 @@ exports[`auto-unwrap > twoChildren 1`] = ` } `; +exports[`auto-unwrap > twoChildren 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "children": [ + { + "position": { + "end": { + "column": 10, + "line": 2, + "offset": 16, + }, + "start": { + "column": 3, + "line": 2, + "offset": 9, + }, + }, + "type": "text", + "value": "Foo bar", + }, + ], + "position": { + "end": { + "column": 10, + "line": 2, + "offset": 16, + }, + "start": { + "column": 3, + "line": 2, + "offset": 9, + }, + }, + "type": "paragraph", + }, + { + "children": [ + { + "position": { + "end": { + "column": 14, + "line": 4, + "offset": 31, + }, + "start": { + "column": 3, + "line": 4, + "offset": 20, + }, + }, + "type": "text", + "value": "Hello World", + }, + ], + "position": { + "end": { + "column": 14, + "line": 4, + "offset": 31, + }, + "start": { + "column": 3, + "line": 4, + "offset": 20, + }, + }, + "type": "paragraph", + }, + ], + "data": { + "hName": "test", + "hProperties": {}, + }, + "fmAttributes": {}, + "name": "test", + "position": { + "end": { + "column": 3, + "line": 5, + "offset": 34, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 5, + "offset": 34, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; + exports[`auto-unwrap > twoSlots 1`] = ` { "children": [ @@ -435,3 +763,111 @@ exports[`auto-unwrap > twoSlots 1`] = ` "type": "root", } `; + +exports[`auto-unwrap > twoSlots 2`] = ` +{ + "children": [ + { + "attributes": {}, + "children": [ + { + "position": { + "end": { + "column": 10, + "line": 2, + "offset": 16, + }, + "start": { + "column": 3, + "line": 2, + "offset": 9, + }, + }, + "type": "text", + "value": "Foo bar", + }, + { + "attributes": {}, + "children": [ + { + "position": { + "end": { + "column": 14, + "line": 5, + "offset": 38, + }, + "start": { + "column": 3, + "line": 5, + "offset": 27, + }, + }, + "type": "text", + "value": "Hello World", + }, + ], + "data": { + "hName": "component-slot", + "hProperties": { + "v-slot:title": "", + }, + }, + "mdc": { + "unwrapped": "paragraph", + }, + "name": "title", + "position": { + "end": { + "column": 3, + "line": 6, + "offset": 41, + }, + "start": { + "column": 2, + "line": 4, + "offset": 19, + }, + }, + "type": "componentContainerSection", + }, + ], + "data": { + "hName": "test", + "hProperties": {}, + }, + "fmAttributes": {}, + "mdc": { + "unwrapped": "paragraph", + }, + "name": "test", + "position": { + "end": { + "column": 3, + "line": 6, + "offset": 41, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "rawData": undefined, + "type": "containerComponent", + }, + ], + "position": { + "end": { + "column": 3, + "line": 6, + "offset": 41, + }, + "start": { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": "root", +} +`; diff --git a/test/block-component.test.ts b/test/block-component.test.ts index eeb8a05..4343d17 100644 --- a/test/block-component.test.ts +++ b/test/block-component.test.ts @@ -139,11 +139,11 @@ describe('block-component', () => { '#secondary-slot', 'Secondary slot value', '', - ' :::hello', - ' ---', - ' key: value', - ' ---', - ' :::', + ':::hello', + '---', + 'key: value', + '---', + ':::', '::', ].join('\n'), }, @@ -342,5 +342,398 @@ describe('block-component', () => { expect(slot.attributes).toEqual({ key: 'value' }) }, }, + 'indent-children': { + markdown: [ + ':::parent', + '', + '- item 1', + '- item 2', + '', + '::component', + 'compoennt', + '::', + '', + ':::', + ].join('\n'), + expected: [ + '::parent', + '- item 1', + '- item 2', + '', + ':::component', + 'compoennt', + ':::', + '::', + ].join('\n'), + }, + }, { indentContent: false }) + + // Indented + runMarkdownTests({ + 'empty': { + markdown: '::component\n::', + expected: '::component\n::', + }, + 'text': { + markdown: '::component\ntext\n::', + expected: '::component\n text\n::', + }, + 'empty-slot': { + markdown: '::component\n#text\n::', + expected: '::component\n#text\n::', + }, + 'component-attributes': { + markdown: '::component{key="value"}\n::', + }, + 'component-attributes-remove-duplicate': { + markdown: '::component{key="value" key="value"}\n::', + expected: '::component{key="value"}\n::', + }, + 'component-attributes-length-80': { + // `::component{a=""}` = 17 characters + 1 because array start at 0 + markdown: `::component{a="${Array.from({ length: 80 - 17 + 1 }).join('a')}"}\n::`, + }, + 'component-attributes-length-81': { + markdown: `::component{a="${Array.from({ length: 81 - 17 + 1 }).join('a')}"}\n::`, + expected: [ + '::component', + '---', + `a: ${Array.from({ length: 81 - 17 + 1 }).join('a')}`, + '---', + '::', + ].join('\n'), + }, + 'component-max-attributes-length-option': { + mdcOptions: { + maxAttributesLength: 100, + }, + markdown: `::component{a="${Array.from({ length: 100 - 17 + 1 }).join('a')}"}\n::`, + }, + 'frontmatter': { + markdown: '::with-frontmatter\n---\nkey: value\narray:\n - item\n - itemKey: value\n---\n::', + expected: '::with-frontmatter\n---\narray:\n - item\n - itemKey: value\nkey: value\n---\n::', + }, + 'jsonScapeAttr': { + markdown: '::foo{:test=\'{"foo":"I\\\'d love to"}\'}\n::', + extra: (_md, ast) => { + expect(ast.children[0].type).toBe('containerComponent') + }, + }, + 'frontmatter1': { + markdown: [ + '::with-frontmatter', + '---', + 'key: value', + 'key2:', + ' subkey: value', + ' subkey2: value', + 'array:', + ' - item', + ' - itemKey: value', + '---', + '::', + ].join('\n'), + expected: [ + '::with-frontmatter', + '---', + 'array:', + ' - item', + ' - itemKey: value', + 'key: value', + 'key2:', + ' subkey: value', + ' subkey2: value', + '---', + '::', + ].join('\n'), + }, + 'frontmatter-with-binding-variables': { + markdown: [ + '::with-frontmatter', + '---', + ':key: value', + 'array:', + ' - item', + ' - :itemKey: value', + 'object:', + ' :subkey: value', + ' subkey2: value', + '---', + '::', + ].join('\n'), + }, + 'nested-component': { + markdown: [ + '::with-frontmatter-and-nested-component', + '---', + 'key: value', + 'array:', + ' - item', + ' - itemKey: value', + '---', + 'Default slot', + '', + '#secondary-slot', + 'Secondary slot value', + '', + ' :::hello', + ' ---', + ' key: value', + ' ---', + ' :::', + '::', + ].join('\n'), + expected: [ + '::with-frontmatter-and-nested-component', + '---', + 'array:', + ' - item', + ' - itemKey: value', + 'key: value', + '---', + ' Default slot', + '', + '#secondary-slot', + ' Secondary slot value', + '', + ' :::hello', + ' ---', + ' key: value', + ' ---', + ' :::', + '::', + ].join('\n'), + }, + 'section-order': { + markdown: [ + '::comp', + '#title', + 'Hello', + '#another-title', + 'World', + '#default', + 'P1', + '', + 'P2', + '', + 'P', + '::', + ].join('\n'), + expected: [ + '::comp', + ' P1', + '', + ' P2', + '', + ' P', + '', + '#title', + ' Hello', + '', + '#another-title', + ' World', + '::', + ].join('\n'), + }, + 'section-order-2': { + markdown: [ + '::comp', + '#a', + 'A', + '#c', + 'C', + '#b', + 'B', + '#default', + 'P1', + '::', + ].join('\n'), + expected: [ + '::comp', + ' P1', + '', + '#a', + ' A', + '', + '#c', + ' C', + '', + '#b', + ' B', + '::', + ].join('\n'), + }, + 'ignore-code-fence': { + markdown: [ + '::component', + ' First line', + '', + ' ```cpp', + ' #include ', + ' ```', + '', + ' Second line', + '::', + '', + 'Third line', + ].join('\n'), + }, + 'dangling-list': { + markdown: [ + '::component', + ' - list item', + ' - list item', + '', + '#slot', + ' slot content', + '::', + ].join('\n'), + }, + 'trim-slot-name': { + markdown: [ + '::component', + '#slot ', + 'slot content', + '::', + ].join('\n'), + expected: [ + '::component', + '#slot', + ' slot content', + '::', + ].join('\n'), + }, + 'sugar-syntax': { + markdown: [ + ':component', + ].join('\n'), + extra: (_md, ast) => { + expect(ast.children[0].type).toBe('textComponent') + expect(ast.children[0].name).toBe('component') + }, + }, + 'component-attributes-bind-frontmatter': { + markdown: '::text-component{:key="value"}\n::', + extra(_, ast) { + expect(ast.children[0].attributes).toEqual({ ':key': 'value' }) + expect(ast.children[0].data.hProperties).toEqual({ ':key': 'value' }) + }, + }, + 'component-attributes-array-of-string': { + markdown: '::container-component{:items=\'["Nuxt", "Vue"]\'}\n::', + // expected: '::container-component{:items="["Nuxt", "Vue"]"}\n::', + extra(_, ast) { + expect(ast.children[0].attributes).toEqual({ ':items': '["Nuxt", "Vue"]' }) + expect(ast.children[0].data.hProperties).toEqual({ ':items': '["Nuxt", "Vue"]' }) + }, + }, + 'component-attributes-bad-array': { + markdown: '::container-component{:items="[Nuxt,Vue]"}\n::', + extra(_, ast) { + expect(ast.children[0].attributes).toEqual({ ':items': '[Nuxt,Vue]' }) + expect(ast.children[0].data.hProperties).toEqual({ ':items': '[Nuxt,Vue]' }) + }, + }, + 'component-attributes-array-of-number': { + markdown: '::container-component{:items=\'[1,2,3.5]\'}\n::', + extra(_, ast) { + expect(ast.children[0].attributes).toEqual({ ':items': '[1,2,3.5]' }) + expect(ast.children[0].data.hProperties).toEqual({ ':items': '[1,2,3.5]' }) + }, + }, + 'component-attributes-array-convert-double-quote': { + markdown: '::container-component{:items="[1,2,3.5]"}\n::', + expected: '::container-component{:items=\'[1,2,3.5]\'}\n::', + extra(_, ast) { + expect(ast.children[0].attributes).toEqual({ ':items': '[1,2,3.5]' }) + expect(ast.children[0].data.hProperties).toEqual({ ':items': '[1,2,3.5]' }) + }, + }, + 'component-attributes-object': { + markdown: '::container-component{:items=\'{"key": "value"}\'}\n::', + extra(_, ast) { + expect(ast.children[0].attributes).toEqual({ ':items': '{"key": "value"}' }) + expect(ast.children[0].data.hProperties).toEqual({ ':items': '{"key": "value"}' }) + }, + }, + 'component-hProperties-be-the-same': { + markdown: [ + '::container-component{:items=\'{"key":"value"}\'}\n::', + '', + '::container-component', + '---', + 'items:', + ' key: value', + '---', + '::', + ].join('\n'), + extra(_, ast) { + expect(ast.children[0].attributes).toEqual({ ':items': '{"key":"value"}' }) + expect(ast.children[1].attributes).toEqual({}) + expect(ast.children[0].data.hProperties).toEqual(ast.children[1].data.hProperties) + }, + }, + 'slot-attributes': { + markdown: [ + '::container-component', + '#slot{key="value"}', + 'slot content', + '::', + ].join('\n'), + expected: [ + '::container-component', + '#slot{key="value"}', + ' slot content', + '::', + ].join('\n'), + extra(_, ast) { + const slot = ast.children[0].children[0] + expect(slot.type).toBe('componentContainerSection') + expect(slot.attributes).toEqual({ key: 'value' }) + }, + }, + 'default-slot-attributes': { + markdown: [ + '::container-component', + '#default{key="value"}', + 'slot content', + '::', + ].join('\n'), + expected: [ + '::container-component', + '#default{key="value"}', + ' slot content', + '::', + ].join('\n'), + extra(_, ast) { + const slot = ast.children[0].children[0] + expect(slot.type).toBe('componentContainerSection') + expect(slot.attributes).toEqual({ key: 'value' }) + }, + }, + 'indent-children': { + markdown: [ + ':::parent', + '', + '- item 1', + '- item 2', + '', + '::component', + 'compoennt', + '::', + '', + ':::', + ].join('\n'), + expected: [ + '::parent', + ' - item 1', + ' - item 2', + '', + ' :::component', + ' compoennt', + ' :::', + '::', + ].join('\n'), + }, }) }) diff --git a/test/codeblock-props.test.ts b/test/codeblock-props.test.ts index 93b18eb..908a87e 100644 --- a/test/codeblock-props.test.ts +++ b/test/codeblock-props.test.ts @@ -108,6 +108,148 @@ describe('codeblock-props', () => { '#secondary-slot', 'Secondary slot value', '', + ':::hello', + '```yaml [props]', + 'key: value', + '```', + ':::', + '::', + ].join('\n'), + extra(_markdown, ast, _expected) { + expect(ast.children[0].type).toEqual('containerComponent') + expect(ast.children[0].fmAttributes).toEqual({ array: ['item', { itemKey: 'value' }], key: 'value' }) + expect(ast.children[0].children[1].children[1].fmAttributes).toEqual({ key: 'value' }) + }, + }, + }, { indentContent: false }) + + // Indented + runMarkdownTests({ + 'YamlProps': { + mdcOptions: { + experimental: { + componentCodeBlockYamlProps: true, + }, + }, + markdown: '::with-frontmatter-yaml\n```yaml [props]\narray:\n - item\n - itemKey: value\nkey: value\n```\n::', + extra(_markdown, ast, _expected) { + expect(ast.children[0].type).toEqual('containerComponent') + expect(ast.children[0].fmAttributes).toEqual({ array: ['item', { itemKey: 'value' }], key: 'value' }) + }, + }, + 'notYamlProps': { + mdcOptions: { + experimental: { + componentCodeBlockYamlProps: true, + }, + }, + markdown: '::with-frontmatter-yaml\n ```yaml\n key: value\n array:\n - item\n - itemKey: value\n ```\n::', + extra(_markdown, ast, _expected) { + expect(ast.children[0].type).toEqual('containerComponent') + expect(ast.children[0].fmAttributes).toEqual({}) + }, + }, + 'notYamlProps2': { + mdcOptions: { + experimental: { + componentCodeBlockYamlProps: true, + }, + }, + markdown: '::with-frontmatter-yaml\n ```yaml[props]\n key: value\n array:\n - item\n - itemKey: value\n ```\n::', + }, + 'notYamlProps3': { + mdcOptions: { + experimental: { + componentCodeBlockYamlProps: true, + }, + }, + markdown: '::with-frontmatter-yaml\n ```yaml [yaml]\n key: value\n array:\n - item\n - itemKey: value\n ```\n::', + }, + 'shouldConvertYamlProps': { + mdcOptions: { + experimental: { + componentCodeBlockYamlProps: true, + }, + }, + markdown: '::with-frontmatter-yaml\n---\narray:\n - item\n - itemKey: value\nkey: value\n---\n::', + expected: '::with-frontmatter-yaml\n```yaml [props]\narray:\n - item\n - itemKey: value\nkey: value\n```\n::', + }, + // shouldConvertYamlPropsWithoutOption: { + // markdown: '::with-frontmatter-yaml\n```yaml [props]\narray:\n - item\n - itemKey: value\nkey: value\n```\n::', + // expected: '::with-frontmatter-yaml\n---\narray:\n - item\n - itemKey: value\nkey: value\n---\n::' + // }, + 'yamlProps1': { + mdcOptions: { + experimental: { + componentCodeBlockYamlProps: true, + }, + }, + markdown: [ + '::with-frontmatter-yaml1', + '```yaml [props]', + 'key: value', + 'key2:', + ' subkey: value', + ' subkey2: value', + 'array:', + ' - item', + ' - itemKey: value', + '```', + '::', + ].join('\n'), + expected: [ + '::with-frontmatter-yaml1', + '```yaml [props]', + 'array:', + ' - item', + ' - itemKey: value', + 'key: value', + 'key2:', + ' subkey: value', + ' subkey2: value', + '```', + '::', + ].join('\n'), + }, + 'nested-component-yamlProps': { + mdcOptions: { + experimental: { + componentCodeBlockYamlProps: true, + }, + }, + markdown: [ + '::with-frontmatter-and-nested-component-yaml', + '```yaml [props]', + 'array:', + ' - item', + ' - itemKey: value', + 'key: value', + '```', + 'Default slot', + '', + '#secondary-slot', + 'Secondary slot value', + '', + ':::hello', + '```yaml [props]', + 'key: value', + '```', + ':::', + '::', + ].join('\n'), + expected: [ + '::with-frontmatter-and-nested-component-yaml', + '```yaml [props]', + 'array:', + ' - item', + ' - itemKey: value', + 'key: value', + '```', + ' Default slot', + '', + '#secondary-slot', + ' Secondary slot value', + '', ' :::hello', ' ```yaml [props]', ' key: value', diff --git a/test/unwrap.test.ts b/test/unwrap.test.ts index 9603254..efeeba4 100644 --- a/test/unwrap.test.ts +++ b/test/unwrap.test.ts @@ -61,6 +61,80 @@ describe('auto-unwrap', () => { } }, }, + componentChildren: { + mdcOptions: { + experimental: { + autoUnwrap: true, + }, + }, + markdown: '::test\n:::another-component\n:::\n::', + extra(_markdown, ast, _expected) { + expect(ast.children[0].children.length).toBe(1) + expect(ast.children[0].children[0]).property('type', 'containerComponent') + }, + }, + }, { indentContent: false }) + + // Indented + runMarkdownTests({ + simple: { + mdcOptions: { + experimental: { + autoUnwrap: true, + }, + }, + markdown: '::test\n Hello World\n::', + extra(_markdown, ast, _expected) { + expect(ast.children[0].children.length).toBe(1) + expect(ast.children[0].children[0]).property('type', 'text') + expect(ast.children[0].children[0]).property('value', 'Hello World') + }, + }, + slot: { + mdcOptions: { + experimental: { + autoUnwrap: true, + }, + }, + markdown: '::test\n#title\n Hello World\n::', + extra(_markdown, ast, _expected) { + const slot = ast.children[0].children[0] + expect(slot.children.length).toBe(1) + expect(slot.children[0]).property('type', 'text') + expect(slot.children[0]).property('value', 'Hello World') + }, + }, + twoSlots: { + mdcOptions: { + experimental: { + autoUnwrap: true, + }, + }, + markdown: '::test\n Foo bar\n\n#title\n Hello World\n::', + extra(_markdown, ast, _expected) { + const nonSlotChild = ast.children[0].children[0] + expect(nonSlotChild).property('type', 'text') + expect(nonSlotChild).property('value', 'Foo bar') + + const slot = ast.children[0].children[1] + expect(slot.children.length).toBe(1) + expect(slot.children[0]).property('type', 'text') + expect(slot.children[0]).property('value', 'Hello World') + }, + }, + twoChildren: { + mdcOptions: { + experimental: { + autoUnwrap: true, + }, + }, + markdown: '::test\n Foo bar\n\n Hello World\n::', + extra(_markdown, ast, _expected) { + for (const child of ast.children[0].children) { + expect(child).property('type', 'paragraph') + } + }, + }, componentChildren: { mdcOptions: { experimental: { diff --git a/test/utils/index.ts b/test/utils/index.ts index fb043f7..d56cf2b 100644 --- a/test/utils/index.ts +++ b/test/utils/index.ts @@ -3,9 +3,10 @@ import parse from 'remark-parse' import gfm from 'remark-gfm' import stringify from 'remark-stringify' import { expect, test } from 'vitest' +import defu from 'defu' import mdc from '../../src' -interface MarkdownTest { +export interface MarkdownTest { markdown: string expected?: string extra?: (markdown: string, ast: any, expected: string) => void @@ -13,23 +14,24 @@ interface MarkdownTest { mdcOptions?: Record } -export function runMarkdownTests(tests: Record) { +export function runMarkdownTests(tests: Record, testsMdcOptions: Record = {}) { for (const key in tests) { const { markdown, expected, extra, plugins = [], mdcOptions = {} } = tests[key] + const _mdcOptions = defu({}, mdcOptions, testsMdcOptions) test(key, async () => { - const ast = await markdownToAST(markdown, plugins, mdcOptions) + const ast = await markdownToAST(markdown, plugins, _mdcOptions) expect(ast).toMatchSnapshot() - const regeneratedMarkdown = await astToMarkdown(ast, plugins, mdcOptions) + const regeneratedMarkdown = await astToMarkdown(ast, plugins, _mdcOptions) expect(regeneratedMarkdown.trim()).toEqual(expected || markdown) if (extra) { extra(markdown, ast, expected || markdown) } // We should be able regenerate same markdown starting from the `regeneratedMarkdown` - const ast2 = await markdownToAST(regeneratedMarkdown, plugins, mdcOptions) - const regeneratedMarkdown2 = await astToMarkdown(ast2, plugins, mdcOptions) + const ast2 = await markdownToAST(regeneratedMarkdown, plugins, _mdcOptions) + const regeneratedMarkdown2 = await astToMarkdown(ast2, plugins, _mdcOptions) expect(regeneratedMarkdown2).toEqual(regeneratedMarkdown) }) }