diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4ef63409..b6c1773e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,18 +13,18 @@ name: "CodeQL" on: push: - branches: [ "main" ] + branches: ["main"] paths: - core/** - docs/** pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ["main"] paths: - core/** - docs/** schedule: - - cron: '0 9 * * 4' + - cron: "0 9 * * 4" jobs: analyze: @@ -38,43 +38,42 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ["javascript"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index d23d2f72..16186676 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -3,11 +3,11 @@ name: Core on: workflow_dispatch: push: - branches: [ "main" ] + branches: ["main"] paths: - core/** pull_request: - branches: [ "main" ] + branches: ["main"] paths: - core/** @@ -16,67 +16,90 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - cache: yarn - cache-dependency-path: core/yarn.lock - node-version: 16 - - - name: Install - working-directory: ./core - run: | - yarn install --frozen-lockfile - - - name: Build - working-directory: ./core - run: | - yarn build + - name: Setup Node + uses: actions/setup-node@v3 + with: + cache: yarn + cache-dependency-path: core/yarn.lock + node-version: 16 + + - name: Install + working-directory: ./core + run: | + yarn install --frozen-lockfile + + - name: Build + working-directory: ./core + run: | + yarn build lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - cache: yarn - cache-dependency-path: core/yarn.lock - node-version: 16 - - - name: Install - working-directory: ./core - run: | - yarn install --frozen-lockfile - - - name: Lint - working-directory: ./core - run: | - yarn lint + - name: Setup Node + uses: actions/setup-node@v3 + with: + cache: yarn + cache-dependency-path: core/yarn.lock + node-version: 16 + + - name: Install + working-directory: ./core + run: | + yarn install --frozen-lockfile + + - name: Lint + working-directory: ./core + run: | + yarn lint test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - cache: yarn - cache-dependency-path: core/yarn.lock - node-version: 16 - - - name: Install - working-directory: ./core - run: | - yarn install --frozen-lockfile - - - name: Test - working-directory: ./core - run: | - yarn test:ci + - name: Setup Node + uses: actions/setup-node@v3 + with: + cache: yarn + cache-dependency-path: core/yarn.lock + node-version: 16 + + - name: Install + working-directory: ./core + run: | + yarn install --frozen-lockfile + + - name: Test + working-directory: ./core + run: | + yarn test:ci + + integration_tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + cache: yarn + cache-dependency-path: core/yarn.lock + node-version: 16 + + - name: Install + working-directory: ./core + run: | + yarn install --frozen-lockfile + + - name: Test + working-directory: ./core + run: | + yarn test:integration:ci diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0a24e249..bc4759d5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -3,11 +3,11 @@ name: Docs on: workflow_dispatch: push: - branches: [ "main" ] + branches: ["main"] paths: - docs/** pull_request: - branches: [ "main" ] + branches: ["main"] paths: - docs/** @@ -16,33 +16,39 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - cache: yarn - cache-dependency-path: docs/yarn.lock - node-version: 16 - - - name: Install - working-directory: ./docs - run: | - yarn install --frozen-lockfile - - - name: Lint - working-directory: ./docs - run: | - yarn lint + - name: Setup Node + uses: actions/setup-node@v3 + with: + cache: yarn + cache-dependency-path: docs/yarn.lock + node-version: 16 + + - name: Install + working-directory: ./docs + run: | + yarn install --frozen-lockfile + + - name: Lint + working-directory: ./docs + run: | + yarn lint test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + + integration_tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 132c824a..3d5c3762 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -24,11 +24,11 @@ jobs: header: pr-title-lint-error message: | Hey there and thank you for opening this pull request! 👋đŸŧ - + We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. Details: - + ``` ${{ steps.lint_pr_title.outputs.error_message }} ``` @@ -36,6 +36,6 @@ jobs: # Delete a previous comment when the issue has been resolved - if: ${{ steps.lint_pr_title.outputs.error_message == null }} uses: marocchino/sticky-pull-request-comment@v2 - with: + with: header: pr-title-lint-error delete: true diff --git a/core/jest.config.integration.js b/core/jest.config.integration.js new file mode 100644 index 00000000..d440a312 --- /dev/null +++ b/core/jest.config.integration.js @@ -0,0 +1,18 @@ +const { pathsToModuleNameMapper } = require('ts-jest'); + +const { compilerOptions } = require('./tsconfig.base'); + +module.exports = { + preset: 'ts-jest', + transform: { + '\\.[jt]sx?$': ['ts-jest', { tsConfig: 'tsconfig.dev.json' }], + '^.+\\.svg$': './test/fileTransformer', + }, + moduleNameMapper: { + ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/' }), + '\\.(css|less)$': '/src/__mocks__/styleMock.ts', + }, + transformIgnorePatterns: [], + setupFiles: ['./test/setupEnv.js'], + testRegex: '\\.ispec\\.tsx?$', +}; diff --git a/core/jest.config.js b/core/jest.config.js index b59413c2..f41e3297 100644 --- a/core/jest.config.js +++ b/core/jest.config.js @@ -12,6 +12,6 @@ module.exports = { ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/' }), '\\.(css|less)$': '/src/__mocks__/styleMock.ts', }, - transformIgnorePatterns: [], setupFiles: ['./test/setupEnv.js'], + testRegex: '\\.spec\\.tsx?$', }; diff --git a/core/package.json b/core/package.json index 880bcb9e..633016b8 100644 --- a/core/package.json +++ b/core/package.json @@ -25,7 +25,9 @@ "prepublishOnly": "yarn build", "start": "run-s clean develop", "test": "cross-env NODE_ENV=test jest", + "test:integration": "cross-env NODE_ENV=test jest -c jest.config.integration.js", "test:ci": "cross-env NODE_ENV=test jest --maxWorkers=2", + "test:integration:ci": "cross-env NODE_ENV=test jest -c jest.config.integration.js --maxWorkers=2", "type-check": "tsc --watch" }, "main": "dist/static-cms-core.js", @@ -54,7 +56,7 @@ "@codemirror/search": "6.2.3", "@codemirror/state": "6.1.4", "@codemirror/theme-one-dark": "6.1.0", - "@codemirror/view": "6.6.0", + "@codemirror/view": "6.7.1", "@dnd-kit/core": "6.0.6", "@dnd-kit/sortable": "7.0.1", "@dnd-kit/utilities": "3.2.1", diff --git a/core/src/__mocks__/@udecode/plate.ts b/core/src/__mocks__/@udecode/plate.ts index b5c9da95..000e5e11 100644 --- a/core/src/__mocks__/@udecode/plate.ts +++ b/core/src/__mocks__/@udecode/plate.ts @@ -1,24 +1,22 @@ -import { - ELEMENT_BLOCKQUOTE, - ELEMENT_CODE_BLOCK, - ELEMENT_H1, - ELEMENT_H2, - ELEMENT_H3, - ELEMENT_H4, - ELEMENT_H5, - ELEMENT_H6, - ELEMENT_IMAGE, - ELEMENT_LI, - ELEMENT_LIC, - ELEMENT_LINK, - ELEMENT_OL, - ELEMENT_PARAGRAPH, - ELEMENT_TABLE, - ELEMENT_TD, - ELEMENT_TH, - ELEMENT_TR, - ELEMENT_UL, -} from '@udecode/plate'; +const ELEMENT_BLOCKQUOTE = 'blockquote'; +const ELEMENT_CODE_BLOCK = 'code_block'; +const ELEMENT_H1 = 'h1'; +const ELEMENT_H2 = 'h2'; +const ELEMENT_H3 = 'h3'; +const ELEMENT_H4 = 'h4'; +const ELEMENT_H5 = 'h5'; +const ELEMENT_H6 = 'h6'; +const ELEMENT_IMAGE = 'img'; +const ELEMENT_LI = 'li'; +const ELEMENT_LIC = 'lic'; +const ELEMENT_LINK = 'a'; +const ELEMENT_OL = 'ol'; +const ELEMENT_PARAGRAPH = 'p'; +const ELEMENT_TABLE = 'table'; +const ELEMENT_TD = 'td'; +const ELEMENT_TH = 'th'; +const ELEMENT_TR = 'tr'; +const ELEMENT_UL = 'ul'; export { ELEMENT_BLOCKQUOTE, diff --git a/core/src/__mocks__/remark-gfm.ts b/core/src/__mocks__/remark-gfm.ts new file mode 100644 index 00000000..ff8b4c56 --- /dev/null +++ b/core/src/__mocks__/remark-gfm.ts @@ -0,0 +1 @@ +export default {}; diff --git a/core/src/__mocks__/remark-mdx.ts b/core/src/__mocks__/remark-mdx.ts new file mode 100644 index 00000000..ff8b4c56 --- /dev/null +++ b/core/src/__mocks__/remark-mdx.ts @@ -0,0 +1 @@ +export default {}; diff --git a/core/src/__mocks__/remark-parse.ts b/core/src/__mocks__/remark-parse.ts new file mode 100644 index 00000000..ff8b4c56 --- /dev/null +++ b/core/src/__mocks__/remark-parse.ts @@ -0,0 +1 @@ +export default {}; diff --git a/core/src/__mocks__/unified.ts b/core/src/__mocks__/unified.ts new file mode 100644 index 00000000..dcb0f5d3 --- /dev/null +++ b/core/src/__mocks__/unified.ts @@ -0,0 +1,9 @@ +/* eslint-disable import/prefer-default-export */ +const unifiedMock = jest.fn().mockImplementation(() => { + return { + use: unifiedMock, + process: unifiedMock, + }; +}); + +export { unifiedMock as unified }; diff --git a/core/src/widgets/markdown/plate/hooks/__tests__/useMarkdownToSlate.spec.ts b/core/src/widgets/markdown/plate/hooks/__tests__/useMarkdownToSlate.ispec.ts similarity index 93% rename from core/src/widgets/markdown/plate/hooks/__tests__/useMarkdownToSlate.spec.ts rename to core/src/widgets/markdown/plate/hooks/__tests__/useMarkdownToSlate.ispec.ts index 8d3c8e0c..babdf9b6 100644 --- a/core/src/widgets/markdown/plate/hooks/__tests__/useMarkdownToSlate.spec.ts +++ b/core/src/widgets/markdown/plate/hooks/__tests__/useMarkdownToSlate.ispec.ts @@ -8,6 +8,11 @@ import { markdownToSlate } from '../useMarkdownToSlate'; import type { SerializationTestData } from '../../tests-util/serializationTests.util'; import type { UseMarkdownToSlateOptions } from '../useMarkdownToSlate'; +jest.unmock('remark-gfm'); +jest.unmock('remark-mdx'); +jest.unmock('remark-parse'); +jest.unmock('unified'); + async function expectNodes( markdown: string, options: UseMarkdownToSlateOptions, diff --git a/core/src/widgets/markdown/plate/serialization/slate/__test__/processShortcodeConfig.spec.ts b/core/src/widgets/markdown/plate/serialization/slate/__tests__/processShortcodeConfig.spec.ts similarity index 100% rename from core/src/widgets/markdown/plate/serialization/slate/__test__/processShortcodeConfig.spec.ts rename to core/src/widgets/markdown/plate/serialization/slate/__tests__/processShortcodeConfig.spec.ts diff --git a/core/src/widgets/markdown/plate/serialization/slate/__tests__/toSlatePlugin.spec.ts b/core/src/widgets/markdown/plate/serialization/slate/__tests__/toSlatePlugin.spec.ts new file mode 100644 index 00000000..8be7b1d8 --- /dev/null +++ b/core/src/widgets/markdown/plate/serialization/slate/__tests__/toSlatePlugin.spec.ts @@ -0,0 +1,37 @@ +import { + deserializationOnlyTestData, + runSerializationTests, + testShortcodeConfigs as shortcodeConfigs, +} from '../../../tests-util/serializationTests.util'; +import { slateCompiler } from '../toSlatePlugin'; + +import type { SerializationTestData } from '../../../tests-util/serializationTests.util'; +import type { MdastNode } from '../ast-types'; + +async function expectNodes( + mdast: MdastNode, + useMdx: boolean, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + children: any[], +) { + const compiler = slateCompiler({ useMdx, shortcodeConfigs }); + + expect(compiler(mdast)).toEqual(children); +} + +function testRunner(key: string, mode: 'markdown' | 'mdx' | 'both', data: SerializationTestData) { + it(`deserializes ${key}`, async () => { + if (mode === 'both') { + await expectNodes(data.mdast, false, data.slate); + await expectNodes(data.mdast, true, data.slate); + return; + } + + await expectNodes(data.mdast, mode === 'mdx', data.slate); + }); +} + +describe('markdownToSlate', () => { + runSerializationTests(testRunner); + runSerializationTests(testRunner, deserializationOnlyTestData); +}); diff --git a/core/src/widgets/markdown/plate/serialization/slate/ast-types.ts b/core/src/widgets/markdown/plate/serialization/slate/ast-types.ts index c6208a94..c378257a 100644 --- a/core/src/widgets/markdown/plate/serialization/slate/ast-types.ts +++ b/core/src/widgets/markdown/plate/serialization/slate/ast-types.ts @@ -104,7 +104,7 @@ export interface ShortcodeNode extends BaseMdastNode { args: string[]; } -export type MdastNode = BaseMdastNode | MdxMdastNode | ShortcodeNode; +export type MdastNode = BaseMdastNode | MdxTextMdastNode | MdxFlowMdastNode | ShortcodeNode; export interface BaseMdastNode { type?: Omit; @@ -115,7 +115,10 @@ export interface BaseMdastNode { depth?: 1 | 2 | 3 | 4 | 5 | 6; url?: string; alt?: string; - lang?: string; + lang?: string | null; + title?: string | null; + start?: number | null; + meta?: null; // mdast metadata // eslint-disable-next-line @typescript-eslint/no-explicit-any position?: any; @@ -156,12 +159,17 @@ export type MdxMdastNodeAttribute = | ColorMdxMdastNodeAttribute | AlignMdxMdastNodeAttribute; -export interface MdxMdastNode extends BaseMdastNode { +export interface MdxTextMdastNode extends BaseMdastNode { type: 'mdxJsxTextElement'; name: string; attributes?: MdxMdastNodeAttribute[]; } +export interface MdxFlowMdastNode extends BaseMdastNode { + type: 'mdxJsxFlowElement'; + name: string; +} + export interface TextNodeStyles { color?: string; backgroundColor?: string; diff --git a/core/src/widgets/markdown/plate/serialization/slate/deserializeMarkdown.ts b/core/src/widgets/markdown/plate/serialization/slate/deserializeMarkdown.ts index 91839fe6..adb846b8 100644 --- a/core/src/widgets/markdown/plate/serialization/slate/deserializeMarkdown.ts +++ b/core/src/widgets/markdown/plate/serialization/slate/deserializeMarkdown.ts @@ -20,7 +20,7 @@ import type { ListNode, MarkNode, MdastNode, - MdxMdastNode, + MdxTextMdastNode, ParagraphNode, StyleMdxMdastNodeAttribute, TextNode, @@ -57,7 +57,7 @@ function mdxToMark(mark: keyof typeof MarkNodeTypes, children: DeserializedNode[ } as MarkNode; } -function parseStyleAttribute(node: MdxMdastNode, allowedStyles: Record) { +function parseStyleAttribute(node: MdxTextMdastNode, allowedStyles: Record) { const styleAttribute = node.attributes?.find( a => a.name === 'style', ) as StyleMdxMdastNodeAttribute; @@ -281,7 +281,7 @@ export default function deserializeMarkdown(node: MdastNode, options: Options) { return { text: node.value || '' }; case 'mdxJsxTextElement': - if ('name' in node) { + if ('name' in node && node.type === 'mdxJsxTextElement') { switch (node.name) { case 'br': return [{ text: '\n' }]; diff --git a/core/src/widgets/markdown/plate/serialization/slate/toSlatePlugin.ts b/core/src/widgets/markdown/plate/serialization/slate/toSlatePlugin.ts index 11ce9aed..a3f6209c 100644 --- a/core/src/widgets/markdown/plate/serialization/slate/toSlatePlugin.ts +++ b/core/src/widgets/markdown/plate/serialization/slate/toSlatePlugin.ts @@ -9,13 +9,17 @@ export interface ToSlatePluginOptions { useMdx: boolean; } -const toSlatePlugin = ({ shortcodeConfigs, useMdx }: ToSlatePluginOptions): Plugin => - function () { - const compiler = (node: { children: Array }) => { - return node.children.map((c, index) => transform(c, { shortcodeConfigs, useMdx, index })); - }; +export const slateCompiler = + ({ shortcodeConfigs, useMdx }: ToSlatePluginOptions) => + (node: MdastNode) => { + return ( + node.children?.map((c, index) => transform(c, { shortcodeConfigs, useMdx, index })) ?? [] + ); + }; - this.Compiler = compiler; +const toSlatePlugin = (options: ToSlatePluginOptions): Plugin => + function () { + this.Compiler = slateCompiler(options); }; export default toSlatePlugin; diff --git a/core/src/widgets/markdown/plate/tests-util/serializationTests.util.tsx b/core/src/widgets/markdown/plate/tests-util/serializationTests.util.tsx index b8a1a97c..35365b37 100644 --- a/core/src/widgets/markdown/plate/tests-util/serializationTests.util.tsx +++ b/core/src/widgets/markdown/plate/tests-util/serializationTests.util.tsx @@ -25,6 +25,7 @@ import { ELEMENT_SHORTCODE } from '../plateTypes'; import type { ShortcodeConfig } from '@staticcms/core/interface'; import type { MdValue } from '../plateTypes'; +import type { MdastNode } from '../serialization'; export const testShortcodeConfigs: Record = { twitter: { @@ -45,825 +46,2302 @@ export const testShortcodeConfigs: Record = { export interface SerializationTestData { markdown: string; + mdast: MdastNode; slate: MdValue; } interface SerializationMarkdownMdxSplitTests { markdown?: Record; mdx?: Record; + both?: Record; } -function isSerializationTest( - input: - | SerializationMarkdownMdxSplitTests - | SerializationTestData - | Record, -): input is SerializationTestData { - return 'markdown' in input && 'slate' in input; -} - -function isSerializationMarkdownMdxSplitTests( - input: - | SerializationMarkdownMdxSplitTests - | SerializationTestData - | Record, -): input is SerializationMarkdownMdxSplitTests { - return 'mdx' in input || ('markdown' in input && !('slate' in input)); -} - -type SerializationTests = Record< - string, - SerializationMarkdownMdxSplitTests | SerializationTestData | Record ->; +type SerializationTests = Record; const serializationTestData: SerializationTests = { 'plain text': { - paragraph: { - markdown: 'A line of text', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + paragraph: { + markdown: 'A line of text', + mdast: { + type: 'root', children: [ { - text: 'A line of text', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'A line of text', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 15, offset: 14 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 15, offset: 14 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 15, offset: 14 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'A line of text', + }, + ], + }, + ] as MdValue, + }, - 'paragraph with line break': { - markdown: `A line of text + 'paragraph with line break': { + markdown: `A line of text With another in the same paragraph`, - slate: [ - { - type: ELEMENT_PARAGRAPH, + mdast: { + type: 'root', children: [ { - text: 'A line of text\nWith another in the same paragraph', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'A line of text\nWith another in the same paragraph', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 2, column: 35, offset: 49 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 2, column: 35, offset: 49 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 2, column: 35, offset: 49 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'A line of text\nWith another in the same paragraph', + }, + ], + }, + ], + }, - 'two paragraphs': { - markdown: `A line of text + 'two paragraphs': { + markdown: `A line of text And a completely new paragraph`, - slate: [ - { - type: ELEMENT_PARAGRAPH, + mdast: { + type: 'root', children: [ { - text: 'A line of text', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'A line of text', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 15, offset: 14 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 15, offset: 14 }, + }, }, - ], - }, - { - type: ELEMENT_PARAGRAPH, - children: [ { - text: 'And a completely new paragraph', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'And a completely new paragraph', + position: { + start: { line: 3, column: 1, offset: 16 }, + end: { line: 3, column: 31, offset: 46 }, + }, + }, + ], + position: { + start: { line: 3, column: 1, offset: 16 }, + end: { line: 3, column: 31, offset: 46 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 31, offset: 46 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'A line of text', + }, + ], + }, + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'And a completely new paragraph', + }, + ], + }, + ], + }, }, }, headers: { - 'header 1': { - markdown: '# Header One', - slate: [ - { - type: ELEMENT_H1, + both: { + 'header 1': { + markdown: '# Header One', + mdast: { + type: 'root', children: [ { - text: 'Header One', + type: 'heading', + depth: 1, + children: [ + { + type: 'text', + value: 'Header One', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 13, offset: 12 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 13, offset: 12 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 13, offset: 12 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_H1, + children: [ + { + text: 'Header One', + }, + ], + }, + ], + }, - 'header 2': { - markdown: '## Header Two', - slate: [ - { - type: ELEMENT_H2, + 'header 2': { + markdown: '## Header Two', + mdast: { + type: 'root', children: [ { - text: 'Header Two', + type: 'heading', + depth: 2, + children: [ + { + type: 'text', + value: 'Header Two', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 14, offset: 13 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 14, offset: 13 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 14, offset: 13 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_H2, + children: [ + { + text: 'Header Two', + }, + ], + }, + ], + }, - 'header 3': { - markdown: '### Header Three', - slate: [ - { - type: ELEMENT_H3, + 'header 3': { + markdown: '### Header Three', + mdast: { + type: 'root', children: [ { - text: 'Header Three', + type: 'heading', + depth: 3, + children: [ + { + type: 'text', + value: 'Header Three', + position: { + start: { line: 1, column: 5, offset: 4 }, + end: { line: 1, column: 17, offset: 16 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 17, offset: 16 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 17, offset: 16 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_H3, + children: [ + { + text: 'Header Three', + }, + ], + }, + ], + }, - 'header 4': { - markdown: '#### Header Four', - slate: [ - { - type: ELEMENT_H4, + 'header 4': { + markdown: '#### Header Four', + mdast: { + type: 'root', children: [ { - text: 'Header Four', + type: 'heading', + depth: 4, + children: [ + { + type: 'text', + value: 'Header Four', + position: { + start: { line: 1, column: 6, offset: 5 }, + end: { line: 1, column: 17, offset: 16 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 17, offset: 16 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 17, offset: 16 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_H4, + children: [ + { + text: 'Header Four', + }, + ], + }, + ], + }, - 'header 5': { - markdown: '##### Header Five', - slate: [ - { - type: ELEMENT_H5, + 'header 5': { + markdown: '##### Header Five', + mdast: { + type: 'root', children: [ { - text: 'Header Five', + type: 'heading', + depth: 5, + children: [ + { + type: 'text', + value: 'Header Five', + position: { + start: { line: 1, column: 7, offset: 6 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_H5, + children: [ + { + text: 'Header Five', + }, + ], + }, + ], + }, - 'header 6': { - markdown: '###### Header Six', - slate: [ - { - type: ELEMENT_H6, + 'header 6': { + markdown: '###### Header Six', + mdast: { + type: 'root', children: [ { - text: 'Header Six', + type: 'heading', + depth: 6, + children: [ + { + type: 'text', + value: 'Header Six', + position: { + start: { line: 1, column: 8, offset: 7 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, }, - ], + slate: [ + { + type: ELEMENT_H6, + children: [ + { + text: 'Header Six', + }, + ], + }, + ], + }, }, }, blockquote: { - blockquote: { - markdown: '> I am a block quote', - slate: [ - { - type: ELEMENT_BLOCKQUOTE, + both: { + blockquote: { + markdown: '> I am a block quote', + mdast: { + type: 'root', children: [ { - text: 'I am a block quote', - }, - ], - }, - ], - }, - - 'multiline blockquote': { - markdown: '> I am a block quote\n> And another line', - slate: [ - { - type: ELEMENT_BLOCKQUOTE, - children: [ - { - text: 'I am a block quote\nAnd another line', - }, - ], - }, - ], - }, - - 'nested blockquote': { - markdown: '> I am a block quote\n> > And another line', - slate: [ - { - type: ELEMENT_BLOCKQUOTE, - children: [ - { - text: 'I am a block quote', - }, - { - type: ELEMENT_BLOCKQUOTE, + type: 'blockquote', children: [ { - text: 'And another line', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'I am a block quote', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, + ], + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 21, offset: 20 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 21, offset: 20 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 21, offset: 20 }, + }, }, - ] as MdValue, + slate: [ + { + type: ELEMENT_BLOCKQUOTE, + children: [ + { + text: 'I am a block quote', + }, + ], + }, + ], + }, + + 'multiline blockquote': { + markdown: '> I am a block quote\n> And another line', + mdast: { + type: 'root', + children: [ + { + type: 'blockquote', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'I am a block quote\nAnd another line', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 2, column: 19, offset: 39 }, + }, + }, + ], + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 2, column: 19, offset: 39 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 2, column: 19, offset: 39 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 2, column: 19, offset: 39 }, + }, + }, + slate: [ + { + type: ELEMENT_BLOCKQUOTE, + children: [ + { + text: 'I am a block quote\nAnd another line', + }, + ], + }, + ], + }, + + 'nested blockquote': { + markdown: '> I am a block quote\n> > And another line', + mdast: { + type: 'root', + children: [ + { + type: 'blockquote', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'I am a block quote', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, + ], + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, + { + type: 'blockquote', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'And another line', + position: { + start: { line: 2, column: 5, offset: 25 }, + end: { line: 2, column: 21, offset: 41 }, + }, + }, + ], + position: { + start: { line: 2, column: 5, offset: 25 }, + end: { line: 2, column: 21, offset: 41 }, + }, + }, + ], + position: { + start: { line: 2, column: 3, offset: 23 }, + end: { line: 2, column: 21, offset: 41 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 2, column: 21, offset: 41 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 2, column: 21, offset: 41 }, + }, + }, + slate: [ + { + type: ELEMENT_BLOCKQUOTE, + children: [ + { + text: 'I am a block quote', + }, + { + type: ELEMENT_BLOCKQUOTE, + children: [ + { + text: 'And another line', + }, + ], + }, + ], + }, + ] as MdValue, + }, }, }, code: { - 'inline code': { - markdown: "`Colored Text`", - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + 'inline code': { + markdown: "`Colored Text`", + mdast: { + type: 'root', children: [ { - code: true, - text: "Colored Text", + type: 'paragraph', + children: [ + { + type: 'inlineCode', + value: + "Colored Text", + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 79, offset: 78 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 79, offset: 78 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 79, offset: 78 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + code: true, + text: "Colored Text", + }, + ], + }, + ], + }, }, }, 'code block': { - 'code block': { - markdown: - "```\nColored Text\n```", - slate: [ - { - type: ELEMENT_CODE_BLOCK, - code: "Colored Text", - lang: null, + both: { + 'code block': { + markdown: + "```\nColored Text\n```", + mdast: { + type: 'root', children: [ { - text: '', + type: 'code', + lang: null, + meta: null, + value: "Colored Text", + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 4, offset: 84 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 4, offset: 84 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_CODE_BLOCK, + code: "Colored Text", + lang: null, + children: [ + { + text: '', + }, + ], + }, + ] as MdValue, + }, - 'code block with language': { - markdown: - "```javascript\nColored Text\n```", - slate: [ - { - type: ELEMENT_CODE_BLOCK, - code: "Colored Text", - lang: 'javascript', + 'code block with language': { + markdown: + "```javascript\nColored Text\n```", + mdast: { + type: 'root', children: [ { - text: '', + type: 'code', + lang: 'javascript', + meta: null, + value: "Colored Text", + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 4, offset: 94 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 4, offset: 94 }, + }, }, - ], + slate: [ + { + type: ELEMENT_CODE_BLOCK, + code: "Colored Text", + lang: 'javascript', + children: [ + { + text: '', + }, + ], + }, + ], + }, }, }, image: { - image: { - markdown: '![Alt Text](https://example.com/picture.png)', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + image: { + markdown: '![Alt Text](https://example.com/picture.png)', + mdast: { + type: 'root', children: [ { - type: ELEMENT_IMAGE, - url: 'https://example.com/picture.png', - alt: 'Alt Text', + type: 'paragraph', children: [ { - text: '', + type: 'image', + title: null, + url: 'https://example.com/picture.png', + alt: 'Alt Text', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 45, offset: 44 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 45, offset: 44 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 45, offset: 44 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + type: ELEMENT_IMAGE, + url: 'https://example.com/picture.png', + alt: 'Alt Text', + children: [ + { + text: '', + }, + ], + }, + ], + }, + ] as MdValue, + }, - 'image without alt text': { - markdown: '![](https://example.com/picture.png)', - slate: [ - { - type: ELEMENT_PARAGRAPH, + 'image without alt text': { + markdown: '![](https://example.com/picture.png)', + mdast: { + type: 'root', children: [ { - type: ELEMENT_IMAGE, - url: 'https://example.com/picture.png', - alt: '', + type: 'paragraph', children: [ { - text: '', + type: 'image', + title: null, + url: 'https://example.com/picture.png', + alt: '', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 37, offset: 36 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 37, offset: 36 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 37, offset: 36 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + type: ELEMENT_IMAGE, + url: 'https://example.com/picture.png', + alt: '', + children: [ + { + text: '', + }, + ], + }, + ], + }, + ], + }, }, }, link: { - links: { - markdown: '[Link Text](https://example.com/)', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + links: { + markdown: '[Link Text](https://example.com/)', + mdast: { + type: 'root', children: [ { - type: ELEMENT_LINK, - url: 'https://example.com/', + type: 'paragraph', children: [ { - text: 'Link Text', + type: 'link', + title: null, + url: 'https://example.com/', + children: [ + { + type: 'text', + value: 'Link Text', + position: { + start: { line: 1, column: 2, offset: 1 }, + end: { line: 1, column: 11, offset: 10 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 34, offset: 33 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 34, offset: 33 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 34, offset: 33 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + type: ELEMENT_LINK, + url: 'https://example.com/', + children: [ + { + text: 'Link Text', + }, + ], + }, + ], + }, + ], + }, }, }, list: { - 'unordered list': { - markdown: `- List Item 1 + both: { + 'unordered list': { + markdown: `- List Item 1 - List Item 2 - List Item 3`, - slate: [ - { - type: ELEMENT_UL, + mdast: { + type: 'root', children: [ { - type: ELEMENT_LI, - checked: null, + type: 'list', + ordered: false, + start: null, + spread: false, children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 1', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 1', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 14, offset: 13 }, + }, + }, + ], + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 14, offset: 13 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 14, offset: 13 }, + }, }, - ], - }, - { - type: ELEMENT_LI, - checked: null, - children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 2', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 2', + position: { + start: { line: 2, column: 3, offset: 16 }, + end: { line: 2, column: 14, offset: 27 }, + }, + }, + ], + position: { + start: { line: 2, column: 3, offset: 16 }, + end: { line: 2, column: 14, offset: 27 }, + }, }, ], + position: { + start: { line: 2, column: 1, offset: 14 }, + end: { line: 2, column: 14, offset: 27 }, + }, }, - ], - }, - { - type: ELEMENT_LI, - checked: null, - children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 3', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 3', + position: { + start: { line: 3, column: 3, offset: 30 }, + end: { line: 3, column: 14, offset: 41 }, + }, + }, + ], + position: { + start: { line: 3, column: 3, offset: 30 }, + end: { line: 3, column: 14, offset: 41 }, + }, }, ], + position: { + start: { line: 3, column: 1, offset: 28 }, + end: { line: 3, column: 14, offset: 41 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 14, offset: 41 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 14, offset: 41 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_UL, + children: [ + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 1', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 2', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 3', + }, + ], + }, + ], + }, + ], + }, + ] as MdValue, + }, - 'nested unordered list': { - markdown: `- List Item 1 + 'nested unordered list': { + markdown: `- List Item 1 - List Item 2 - List Item 3`, - slate: [ - { - type: ELEMENT_UL, + mdast: { + type: 'root', children: [ { - type: ELEMENT_LI, - checked: null, + type: 'list', + ordered: false, + start: null, + spread: false, children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 1', - }, - ], - }, - ], - }, - { - type: ELEMENT_LI, - checked: null, - children: [ - { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 2', - }, - ], - }, - { - type: ELEMENT_UL, - children: [ - { - type: ELEMENT_LI, - checked: null, + type: 'paragraph', children: [ { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 3', - }, - ], + type: 'text', + value: 'List Item 1', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 14, offset: 13 }, + }, }, ], + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 14, offset: 13 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 14, offset: 13 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 2', + position: { + start: { line: 2, column: 3, offset: 16 }, + end: { line: 2, column: 14, offset: 27 }, + }, + }, + ], + position: { + start: { line: 2, column: 3, offset: 16 }, + end: { line: 2, column: 14, offset: 27 }, + }, + }, + { + type: 'list', + ordered: false, + start: null, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 3', + position: { + start: { line: 3, column: 5, offset: 32 }, + end: { line: 3, column: 16, offset: 43 }, + }, + }, + ], + position: { + start: { line: 3, column: 5, offset: 32 }, + end: { line: 3, column: 16, offset: 43 }, + }, + }, + ], + position: { + start: { line: 3, column: 3, offset: 30 }, + end: { line: 3, column: 16, offset: 43 }, + }, + }, + ], + position: { + start: { line: 3, column: 3, offset: 30 }, + end: { line: 3, column: 16, offset: 43 }, + }, + }, + ], + position: { + start: { line: 2, column: 1, offset: 14 }, + end: { line: 3, column: 16, offset: 43 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 16, offset: 43 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 16, offset: 43 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_UL, + children: [ + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 1', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 2', + }, + ], + }, + { + type: ELEMENT_UL, + children: [ + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 3', + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ] as MdValue, + }, - 'todo unordered list': { - markdown: `- [ ] List Item 1 + 'todo unordered list': { + markdown: `- [ ] List Item 1 - [x] List Item 2 - [x] List Item 3`, - slate: [ - { - type: ELEMENT_UL, + mdast: { + type: 'root', children: [ { - type: ELEMENT_LI, - checked: false, + type: 'list', + ordered: false, + start: null, + spread: false, children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: false, children: [ { - text: 'List Item 1', - }, - ], - }, - ], - }, - { - type: ELEMENT_LI, - checked: true, - children: [ - { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 2', - }, - ], - }, - { - type: ELEMENT_UL, - children: [ - { - type: ELEMENT_LI, - checked: true, + type: 'paragraph', children: [ { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 3', - }, - ], + type: 'text', + value: 'List Item 1', + position: { + start: { line: 1, column: 7, offset: 6 }, + end: { line: 1, column: 18, offset: 17 }, + }, }, ], + position: { + start: { line: 1, column: 7, offset: 6 }, + end: { line: 1, column: 18, offset: 17 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: true, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 2', + position: { + start: { line: 2, column: 7, offset: 24 }, + end: { line: 2, column: 18, offset: 35 }, + }, + }, + ], + position: { + start: { line: 2, column: 7, offset: 24 }, + end: { line: 2, column: 18, offset: 35 }, + }, + }, + { + type: 'list', + ordered: false, + start: null, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: true, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 3', + position: { + start: { line: 3, column: 9, offset: 44 }, + end: { line: 3, column: 20, offset: 55 }, + }, + }, + ], + position: { + start: { line: 3, column: 9, offset: 44 }, + end: { line: 3, column: 20, offset: 55 }, + }, + }, + ], + position: { + start: { line: 3, column: 3, offset: 38 }, + end: { line: 3, column: 20, offset: 55 }, + }, + }, + ], + position: { + start: { line: 3, column: 3, offset: 38 }, + end: { line: 3, column: 20, offset: 55 }, + }, + }, + ], + position: { + start: { line: 2, column: 1, offset: 18 }, + end: { line: 3, column: 20, offset: 55 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 20, offset: 55 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 20, offset: 55 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_UL, + children: [ + { + type: ELEMENT_LI, + checked: false, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 1', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: true, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 2', + }, + ], + }, + { + type: ELEMENT_UL, + children: [ + { + type: ELEMENT_LI, + checked: true, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 3', + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ] as MdValue, + }, - 'ordered list': { - markdown: `1. List Item 1 + 'ordered list': { + markdown: `1. List Item 1 1. List Item 2 1. List Item 3`, - slate: [ - { - type: ELEMENT_OL, + mdast: { + type: 'root', children: [ { - type: ELEMENT_LI, - checked: null, + type: 'list', + ordered: true, + start: 1, + spread: false, children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 1', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 1', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 15, offset: 14 }, + }, + }, + ], + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 15, offset: 14 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 15, offset: 14 }, + }, }, - ], - }, - { - type: ELEMENT_LI, - checked: null, - children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 2', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 2', + position: { + start: { line: 2, column: 4, offset: 18 }, + end: { line: 2, column: 15, offset: 29 }, + }, + }, + ], + position: { + start: { line: 2, column: 4, offset: 18 }, + end: { line: 2, column: 15, offset: 29 }, + }, }, ], + position: { + start: { line: 2, column: 1, offset: 15 }, + end: { line: 2, column: 15, offset: 29 }, + }, }, - ], - }, - { - type: ELEMENT_LI, - checked: null, - children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 3', + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 3', + position: { + start: { line: 3, column: 4, offset: 33 }, + end: { line: 3, column: 15, offset: 44 }, + }, + }, + ], + position: { + start: { line: 3, column: 4, offset: 33 }, + end: { line: 3, column: 15, offset: 44 }, + }, }, ], + position: { + start: { line: 3, column: 1, offset: 30 }, + end: { line: 3, column: 15, offset: 44 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 15, offset: 44 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 15, offset: 44 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_OL, + children: [ + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 1', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 2', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 3', + }, + ], + }, + ], + }, + ], + }, + ] as MdValue, + }, - 'nested ordered list': { - markdown: `1. List Item 1 + 'nested ordered list': { + markdown: `1. List Item 1 1. List Item 2 1. List Item 3`, - slate: [ - { - type: ELEMENT_OL, + mdast: { + type: 'root', children: [ { - type: ELEMENT_LI, - checked: null, + type: 'list', + ordered: true, + start: 1, + spread: false, children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 1', - }, - ], - }, - ], - }, - { - type: ELEMENT_LI, - checked: null, - children: [ - { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 2', - }, - ], - }, - { - type: ELEMENT_OL, - children: [ - { - type: ELEMENT_LI, - checked: null, + type: 'paragraph', children: [ { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 3', - }, - ], + type: 'text', + value: 'List Item 1', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 15, offset: 14 }, + }, }, ], + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 15, offset: 14 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 15, offset: 14 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 2', + position: { + start: { line: 2, column: 4, offset: 18 }, + end: { line: 2, column: 15, offset: 29 }, + }, + }, + ], + position: { + start: { line: 2, column: 4, offset: 18 }, + end: { line: 2, column: 15, offset: 29 }, + }, + }, + { + type: 'list', + ordered: true, + start: 1, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 3', + position: { + start: { line: 3, column: 7, offset: 36 }, + end: { line: 3, column: 18, offset: 47 }, + }, + }, + ], + position: { + start: { line: 3, column: 7, offset: 36 }, + end: { line: 3, column: 18, offset: 47 }, + }, + }, + ], + position: { + start: { line: 3, column: 4, offset: 33 }, + end: { line: 3, column: 18, offset: 47 }, + }, + }, + ], + position: { + start: { line: 3, column: 4, offset: 33 }, + end: { line: 3, column: 18, offset: 47 }, + }, + }, + ], + position: { + start: { line: 2, column: 1, offset: 15 }, + end: { line: 3, column: 18, offset: 47 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 18, offset: 47 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 18, offset: 47 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_OL, + children: [ + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 1', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 2', + }, + ], + }, + { + type: ELEMENT_OL, + children: [ + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 3', + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ] as MdValue, + }, - 'nested todo ordered list': { - markdown: `1. [x] List Item 1 + 'nested todo ordered list': { + markdown: `1. [x] List Item 1 1. [ ] List Item 2 1. [ ] List Item 3`, - slate: [ - { - type: ELEMENT_OL, + mdast: { + type: 'root', children: [ { - type: ELEMENT_LI, - checked: true, + type: 'list', + ordered: true, + start: 1, + spread: false, children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: true, children: [ { - text: 'List Item 1', - }, - ], - }, - ], - }, - { - type: ELEMENT_LI, - checked: false, - children: [ - { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 2', - }, - ], - }, - { - type: ELEMENT_OL, - children: [ - { - type: ELEMENT_LI, - checked: false, + type: 'paragraph', children: [ { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 3', - }, - ], + type: 'text', + value: 'List Item 1', + position: { + start: { line: 1, column: 8, offset: 7 }, + end: { line: 1, column: 19, offset: 18 }, + }, }, ], + position: { + start: { line: 1, column: 8, offset: 7 }, + end: { line: 1, column: 19, offset: 18 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 19, offset: 18 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: false, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 2', + position: { + start: { line: 2, column: 8, offset: 26 }, + end: { line: 2, column: 19, offset: 37 }, + }, + }, + ], + position: { + start: { line: 2, column: 8, offset: 26 }, + end: { line: 2, column: 19, offset: 37 }, + }, + }, + { + type: 'list', + ordered: true, + start: 1, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: false, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 3', + position: { + start: { line: 3, column: 11, offset: 48 }, + end: { line: 3, column: 22, offset: 59 }, + }, + }, + ], + position: { + start: { line: 3, column: 11, offset: 48 }, + end: { line: 3, column: 22, offset: 59 }, + }, + }, + ], + position: { + start: { line: 3, column: 4, offset: 41 }, + end: { line: 3, column: 22, offset: 59 }, + }, + }, + ], + position: { + start: { line: 3, column: 4, offset: 41 }, + end: { line: 3, column: 22, offset: 59 }, + }, + }, + ], + position: { + start: { line: 2, column: 1, offset: 19 }, + end: { line: 3, column: 22, offset: 59 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 22, offset: 59 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 3, column: 22, offset: 59 }, + }, }, - ] as MdValue, - }, + slate: [ + { + type: ELEMENT_OL, + children: [ + { + type: ELEMENT_LI, + checked: true, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 1', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: false, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 2', + }, + ], + }, + { + type: ELEMENT_OL, + children: [ + { + type: ELEMENT_LI, + checked: false, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 3', + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ] as MdValue, + }, - 'nested mixed list': { - markdown: `- List Item 1 + 'nested mixed list': { + markdown: `- List Item 1 - List Item 2 1. [x] List Item 3 1. [ ] List Item 4`, - slate: [ - { - type: ELEMENT_UL, + mdast: { + type: 'root', children: [ { - type: ELEMENT_LI, - checked: null, + type: 'list', + ordered: false, + start: null, + spread: false, children: [ { - type: ELEMENT_LIC, + type: 'listItem', + spread: false, + checked: null, children: [ { - text: 'List Item 1', - }, - ], - }, - ], - }, - { - type: ELEMENT_LI, - checked: null, - children: [ - { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 2', - }, - ], - }, - { - type: ELEMENT_OL, - children: [ - { - type: ELEMENT_LI, - checked: true, + type: 'paragraph', children: [ { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 3', - }, - ], - }, - ], - }, - { - type: ELEMENT_LI, - checked: false, - children: [ - { - type: ELEMENT_LIC, - children: [ - { - text: 'List Item 4', - }, - ], + type: 'text', + value: 'List Item 1', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 14, offset: 13 }, + }, }, ], + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 14, offset: 13 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 14, offset: 13 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 2', + position: { + start: { line: 2, column: 3, offset: 16 }, + end: { line: 2, column: 14, offset: 27 }, + }, + }, + ], + position: { + start: { line: 2, column: 3, offset: 16 }, + end: { line: 2, column: 14, offset: 27 }, + }, + }, + { + type: 'list', + ordered: true, + start: 1, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: true, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 3', + position: { + start: { line: 3, column: 11, offset: 38 }, + end: { line: 3, column: 22, offset: 49 }, + }, + }, + ], + position: { + start: { line: 3, column: 11, offset: 38 }, + end: { line: 3, column: 22, offset: 49 }, + }, + }, + ], + position: { + start: { line: 3, column: 4, offset: 31 }, + end: { line: 3, column: 22, offset: 49 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: false, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'List Item 4', + position: { + start: { line: 4, column: 11, offset: 60 }, + end: { line: 4, column: 22, offset: 71 }, + }, + }, + ], + position: { + start: { line: 4, column: 11, offset: 60 }, + end: { line: 4, column: 22, offset: 71 }, + }, + }, + ], + position: { + start: { line: 4, column: 4, offset: 53 }, + end: { line: 4, column: 22, offset: 71 }, + }, + }, + ], + position: { + start: { line: 3, column: 4, offset: 31 }, + end: { line: 4, column: 22, offset: 71 }, + }, + }, + ], + position: { + start: { line: 2, column: 1, offset: 14 }, + end: { line: 4, column: 22, offset: 71 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 4, column: 22, offset: 71 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 4, column: 22, offset: 71 }, + }, }, - ] as MdValue, + slate: [ + { + type: ELEMENT_UL, + children: [ + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 1', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: null, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 2', + }, + ], + }, + { + type: ELEMENT_OL, + children: [ + { + type: ELEMENT_LI, + checked: true, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 3', + }, + ], + }, + ], + }, + { + type: ELEMENT_LI, + checked: false, + children: [ + { + type: ELEMENT_LIC, + children: [ + { + text: 'List Item 4', + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + }, + ] as MdValue, + }, }, }, italic: { - 'italic (using _)': { - markdown: '_Italic_', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + 'italic (using _)': { + markdown: '_Italic_', + mdast: { + type: 'root', children: [ { - italic: true, - text: 'Italic', + type: 'paragraph', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Italic', + position: { + start: { line: 1, column: 2, offset: 1 }, + end: { line: 1, column: 8, offset: 7 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + italic: true, + text: 'Italic', + }, + ], + }, + ], + }, }, }, bold: { - 'bold (using **)': { - markdown: '**Bold**', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + 'bold (using **)': { + markdown: '**Bold**', + mdast: { + type: 'root', children: [ { - bold: true, - text: 'Bold', + type: 'paragraph', + children: [ + { + type: 'strong', + children: [ + { + type: 'text', + value: 'Bold', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 7, offset: 6 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + bold: true, + text: 'Bold', + }, + ], + }, + ], + }, }, }, strikethrough: { - strikethrough: { - markdown: '~~Strikethrough~~', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + strikethrough: { + markdown: '~~Strikethrough~~', + mdast: { + type: 'root', children: [ { - strikethrough: true, - text: 'Strikethrough', + type: 'paragraph', + children: [ + { + type: 'delete', + children: [ + { + type: 'text', + value: 'Strikethrough', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 16, offset: 15 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + strikethrough: true, + text: 'Strikethrough', + }, + ], + }, + ], + }, }, }, @@ -871,6 +2349,23 @@ And a completely new paragraph`, markdown: { align: { markdown: "

Align Center

", + mdast: { + type: 'root', + children: [ + { + type: 'html', + value: "

Align Center

", + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 52, offset: 51 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 52, offset: 51 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -887,6 +2382,52 @@ And a completely new paragraph`, mdx: { 'align left': { markdown: "

Align Left

", + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'p', + attributes: [ + { + type: 'mdxJsxAttribute', + name: 'style', + value: { + type: 'mdxJsxAttributeValueExpression', + value: "{ textAlign: 'left' }", + }, + }, + ], + children: [ + { + type: 'text', + value: 'Align Left', + position: { + start: { line: 1, column: 34, offset: 33 }, + end: { line: 1, column: 44, offset: 43 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 48, offset: 47 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 48, offset: 47 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 48, offset: 47 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -897,11 +2438,57 @@ And a completely new paragraph`, }, ], }, - ] as MdValue, + ], }, 'align center': { markdown: "

Align Center

", + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'p', + attributes: [ + { + type: 'mdxJsxAttribute', + name: 'style', + value: { + type: 'mdxJsxAttributeValueExpression', + value: "{ textAlign: 'center' }", + }, + }, + ], + children: [ + { + type: 'text', + value: 'Align Center', + position: { + start: { line: 1, column: 36, offset: 35 }, + end: { line: 1, column: 48, offset: 47 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 52, offset: 51 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 52, offset: 51 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 52, offset: 51 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -917,6 +2504,52 @@ And a completely new paragraph`, 'align right': { markdown: "

Align Right

", + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'p', + attributes: [ + { + type: 'mdxJsxAttribute', + name: 'style', + value: { + type: 'mdxJsxAttributeValueExpression', + value: "{ textAlign: 'right' }", + }, + }, + ], + children: [ + { + type: 'text', + value: 'Align Right', + position: { + start: { line: 1, column: 35, offset: 34 }, + end: { line: 1, column: 46, offset: 45 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 50, offset: 49 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 50, offset: 49 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 50, offset: 49 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -936,6 +2569,32 @@ And a completely new paragraph`, markdown: { 'subscript tag': { markdown: 'Subscript', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Subscript', + position: { + start: { line: 1, column: 6, offset: 5 }, + end: { line: 1, column: 15, offset: 14 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -952,6 +2611,43 @@ And a completely new paragraph`, mdx: { 'subscript tag': { markdown: 'Subscript', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'sub', + attributes: [], + children: [ + { + type: 'text', + value: 'Subscript', + position: { + start: { line: 1, column: 6, offset: 5 }, + end: { line: 1, column: 15, offset: 14 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -971,6 +2667,32 @@ And a completely new paragraph`, markdown: { 'superscript tag': { markdown: 'Superscript', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Superscript', + position: { + start: { line: 1, column: 6, offset: 5 }, + end: { line: 1, column: 17, offset: 16 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 23, offset: 22 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 23, offset: 22 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -987,6 +2709,43 @@ And a completely new paragraph`, mdx: { 'superscript tag': { markdown: 'Superscript', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'sup', + attributes: [], + children: [ + { + type: 'text', + value: 'Superscript', + position: { + start: { line: 1, column: 6, offset: 5 }, + end: { line: 1, column: 17, offset: 16 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 23, offset: 22 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 23, offset: 22 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 23, offset: 22 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1006,6 +2765,32 @@ And a completely new paragraph`, markdown: { 'underline tag': { markdown: 'Underlined', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Underlined', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 14, offset: 13 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1022,6 +2807,43 @@ And a completely new paragraph`, mdx: { 'underline tag': { markdown: 'Underlined', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'u', + attributes: [], + children: [ + { + type: 'text', + value: 'Underlined', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 14, offset: 13 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 18, offset: 17 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1041,6 +2863,33 @@ And a completely new paragraph`, markdown: { 'font tag': { markdown: "Colored Text", + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: + "Colored Text", + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 70, offset: 69 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 77, offset: 76 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 77, offset: 76 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1057,6 +2906,52 @@ And a completely new paragraph`, mdx: { 'color and background color from style attribute of font tag': { markdown: "Colored Text", + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'font', + attributes: [ + { + type: 'mdxJsxAttribute', + name: 'style', + value: { + type: 'mdxJsxAttributeValueExpression', + value: "{ color: 'red', backgroundColor: 'black' }", + }, + }, + ], + children: [ + { + type: 'text', + value: 'Colored Text', + position: { + start: { line: 1, column: 58, offset: 57 }, + end: { line: 1, column: 70, offset: 69 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 77, offset: 76 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 77, offset: 76 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 77, offset: 76 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1077,6 +2972,32 @@ And a completely new paragraph`, markdown: { shortcode: { markdown: '[youtube|p6h-rYSVX90]', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: '[youtube|p6h-rYSVX90]', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1098,7 +3019,32 @@ And a completely new paragraph`, 'shortcode with no args': { markdown: '[youtube]', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: '[youtube]', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 10, offset: 9 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 10, offset: 9 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 10, offset: 9 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1120,7 +3066,32 @@ And a completely new paragraph`, 'shortcode with multiple args': { markdown: '[youtube|p6h-rYSVX90|somethingElse|andOneMore]', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: '[youtube|p6h-rYSVX90|somethingElse|andOneMore]', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 47, offset: 46 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 47, offset: 46 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 47, offset: 46 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1142,7 +3113,32 @@ And a completely new paragraph`, 'shortcode with text before': { markdown: 'Text before [youtube|p6h-rYSVX90]', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Text before [youtube|p6h-rYSVX90]', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 34, offset: 33 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 34, offset: 33 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 34, offset: 33 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1167,7 +3163,32 @@ And a completely new paragraph`, 'shortcode with text after': { markdown: '[youtube|p6h-rYSVX90] and text after', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: '[youtube|p6h-rYSVX90] and text after', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 37, offset: 36 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 37, offset: 36 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 37, offset: 36 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1192,7 +3213,32 @@ And a completely new paragraph`, 'shortcode with text before and after': { markdown: 'Text before [youtube|p6h-rYSVX90] and text after', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Text before [youtube|p6h-rYSVX90] and text after', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 49, offset: 48 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 49, offset: 48 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 49, offset: 48 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1220,7 +3266,32 @@ And a completely new paragraph`, 'multiple shortcodes': { markdown: 'Text before [youtube|p6h-rYSVX90] and {{< twitter 917359331535966209 >}}', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Text before [youtube|p6h-rYSVX90] and {{< twitter 917359331535966209 >}}', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 73, offset: 72 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 73, offset: 72 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 73, offset: 72 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1259,7 +3330,33 @@ And a completely new paragraph`, 'multiple of the same shortcodes': { markdown: 'Text before [youtube|p6h-rYSVX90], [youtube|p6h-rYSVX90], {{< twitter 917359331535966209 >}} and [youtube|p6h-rYSVX90]', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: + 'Text before [youtube|p6h-rYSVX90], [youtube|p6h-rYSVX90], {{< twitter 917359331535966209 >}} and [youtube|p6h-rYSVX90]', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 119, offset: 118 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 119, offset: 118 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 119, offset: 118 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1323,6 +3420,32 @@ And a completely new paragraph`, 'unrecognized shortcode': { markdown: '[someOtherShortcode|andstuff]', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: '[someOtherShortcode|andstuff]', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 30, offset: 29 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 30, offset: 29 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 30, offset: 29 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1338,7 +3461,33 @@ And a completely new paragraph`, 'unrecognized shortcode surrounded by recognized shortcodes': { markdown: 'Text before [youtube|p6h-rYSVX90], [someOtherShortcode|andstuff] and {{< twitter 917359331535966209 >}}', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: + 'Text before [youtube|p6h-rYSVX90], [someOtherShortcode|andstuff] and {{< twitter 917359331535966209 >}}', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 104, offset: 103 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 104, offset: 103 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 104, offset: 103 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1376,7 +3525,32 @@ And a completely new paragraph`, 'plain text': { markdown: 'Some text about something going on somewhere', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Some text about something going on somewhere', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 45, offset: 44 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 45, offset: 44 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 45, offset: 44 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1393,7 +3567,32 @@ And a completely new paragraph`, mdx: { shortcode: { markdown: '[youtube|p6h-rYSVX90]', - + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: '[youtube|p6h-rYSVX90]', + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -1409,144 +3608,336 @@ And a completely new paragraph`, }, table: { - table: { - markdown: `|Name|Age| + both: { + table: { + markdown: `|Name|Age| |---|---| |Bob|25| |Billy|30| |Sam|29|`, - - slate: [ - { - type: ELEMENT_TABLE, + mdast: { + type: 'root', children: [ { - type: ELEMENT_TR, + type: 'table', + align: [null, null], children: [ { - type: ELEMENT_TH, + type: 'tableRow', children: [ { - type: ELEMENT_PARAGRAPH, + type: 'tableCell', children: [ { - text: 'Name', + type: 'text', + value: 'Name', + position: { + start: { line: 1, column: 2, offset: 1 }, + end: { line: 1, column: 6, offset: 5 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 7, offset: 6 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Age', + position: { + start: { line: 1, column: 7, offset: 6 }, + end: { line: 1, column: 10, offset: 9 }, + }, + }, + ], + position: { + start: { line: 1, column: 7, offset: 6 }, + end: { line: 1, column: 11, offset: 10 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 11, offset: 10 }, + }, }, { - type: ELEMENT_TH, + type: 'tableRow', children: [ { - type: ELEMENT_PARAGRAPH, + type: 'tableCell', children: [ { - text: 'Age', - }, - ], - }, - ], - }, - ], - }, - { - type: ELEMENT_TR, - children: [ - { - type: ELEMENT_TD, - children: [ - { - type: ELEMENT_PARAGRAPH, - children: [ - { - text: 'Bob', - }, - ], - }, - ], - }, - { - type: ELEMENT_TD, - children: [ - { - type: ELEMENT_PARAGRAPH, - children: [ - { - text: '25', - }, - ], - }, - ], - }, - ], - }, - { - type: ELEMENT_TR, - children: [ - { - type: ELEMENT_TD, - children: [ - { - type: ELEMENT_PARAGRAPH, - children: [ - { - text: 'Billy', - }, - ], - }, - ], - }, - { - type: ELEMENT_TD, - children: [ - { - type: ELEMENT_PARAGRAPH, - children: [ - { - text: '30', - }, - ], - }, - ], - }, - ], - }, - { - type: ELEMENT_TR, - children: [ - { - type: ELEMENT_TD, - children: [ - { - type: ELEMENT_PARAGRAPH, - children: [ - { - text: 'Sam', - }, - ], - }, - ], - }, - { - type: ELEMENT_TD, - children: [ - { - type: ELEMENT_PARAGRAPH, - children: [ - { - text: '29', + type: 'text', + value: 'Bob', + position: { + start: { line: 3, column: 2, offset: 22 }, + end: { line: 3, column: 5, offset: 25 }, + }, }, ], + position: { + start: { line: 3, column: 1, offset: 21 }, + end: { line: 3, column: 6, offset: 26 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: '25', + position: { + start: { line: 3, column: 6, offset: 26 }, + end: { line: 3, column: 8, offset: 28 }, + }, + }, + ], + position: { + start: { line: 3, column: 6, offset: 26 }, + end: { line: 3, column: 9, offset: 29 }, + }, }, ], + position: { + start: { line: 3, column: 1, offset: 21 }, + end: { line: 3, column: 9, offset: 29 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Billy', + position: { + start: { line: 4, column: 2, offset: 31 }, + end: { line: 4, column: 7, offset: 36 }, + }, + }, + ], + position: { + start: { line: 4, column: 1, offset: 30 }, + end: { line: 4, column: 8, offset: 37 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: '30', + position: { + start: { line: 4, column: 8, offset: 37 }, + end: { line: 4, column: 10, offset: 39 }, + }, + }, + ], + position: { + start: { line: 4, column: 8, offset: 37 }, + end: { line: 4, column: 11, offset: 40 }, + }, + }, + ], + position: { + start: { line: 4, column: 1, offset: 30 }, + end: { line: 4, column: 11, offset: 40 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Sam', + position: { + start: { line: 5, column: 2, offset: 42 }, + end: { line: 5, column: 5, offset: 45 }, + }, + }, + ], + position: { + start: { line: 5, column: 1, offset: 41 }, + end: { line: 5, column: 6, offset: 46 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: '29', + position: { + start: { line: 5, column: 6, offset: 46 }, + end: { line: 5, column: 8, offset: 48 }, + }, + }, + ], + position: { + start: { line: 5, column: 6, offset: 46 }, + end: { line: 5, column: 9, offset: 49 }, + }, + }, + ], + position: { + start: { line: 5, column: 1, offset: 41 }, + end: { line: 5, column: 9, offset: 49 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 5, column: 9, offset: 49 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 5, column: 9, offset: 49 }, + }, }, - ] as MdValue, + slate: [ + { + type: ELEMENT_TABLE, + children: [ + { + type: ELEMENT_TR, + children: [ + { + type: ELEMENT_TH, + children: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'Name', + }, + ], + }, + ], + }, + { + type: ELEMENT_TH, + children: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'Age', + }, + ], + }, + ], + }, + ], + }, + { + type: ELEMENT_TR, + children: [ + { + type: ELEMENT_TD, + children: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'Bob', + }, + ], + }, + ], + }, + { + type: ELEMENT_TD, + children: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: '25', + }, + ], + }, + ], + }, + ], + }, + { + type: ELEMENT_TR, + children: [ + { + type: ELEMENT_TD, + children: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'Billy', + }, + ], + }, + ], + }, + { + type: ELEMENT_TD, + children: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: '30', + }, + ], + }, + ], + }, + ], + }, + { + type: ELEMENT_TR, + children: [ + { + type: ELEMENT_TD, + children: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: 'Sam', + }, + ], + }, + ], + }, + { + type: ELEMENT_TD, + children: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + text: '29', + }, + ], + }, + ], + }, + ], + }, + ], + }, + ] as MdValue, + }, }, }, @@ -1628,6 +4019,1858 @@ Text ahead [youtube|p6h-rYSVX90] and behind and another {{< twitter 917359331535 > - Supports wrappers > 1. [x] React > 1. [ ] More coming soon`, + mdast: { + type: 'root', + children: [ + { + type: 'heading', + depth: 1, + children: [ + { + type: 'text', + value: 'The post is number 1', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 23, offset: 22 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 23, offset: 22 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'image', + title: null, + url: 'https://raw.githubusercontent.com/StaticJsCMS/static-cms/main/static-cms-logo.png', + alt: 'Static CMS', + position: { + start: { line: 3, column: 1, offset: 24 }, + end: { line: 3, column: 97, offset: 120 }, + }, + }, + ], + position: { + start: { line: 3, column: 1, offset: 24 }, + end: { line: 3, column: 97, offset: 120 }, + }, + }, + { + type: 'heading', + depth: 1, + children: [ + { + type: 'text', + value: 'Awesome Editor!', + position: { + start: { line: 5, column: 3, offset: 124 }, + end: { line: 5, column: 18, offset: 139 }, + }, + }, + ], + position: { + start: { line: 5, column: 1, offset: 122 }, + end: { line: 5, column: 18, offset: 139 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'It was ', + position: { + start: { line: 7, column: 1, offset: 141 }, + end: { line: 7, column: 8, offset: 148 }, + }, + }, + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'released as open source in 2022', + position: { + start: { line: 7, column: 9, offset: 149 }, + end: { line: 7, column: 40, offset: 180 }, + }, + }, + ], + position: { + start: { line: 7, column: 8, offset: 148 }, + end: { line: 7, column: 41, offset: 181 }, + }, + }, + { + type: 'text', + value: ' and is ', + position: { + start: { line: 7, column: 41, offset: 181 }, + end: { line: 7, column: 49, offset: 189 }, + }, + }, + { + type: 'emphasis', + children: [ + { + type: 'strong', + children: [ + { + type: 'text', + value: 'continually', + position: { + start: { line: 7, column: 52, offset: 192 }, + end: { line: 7, column: 63, offset: 203 }, + }, + }, + ], + position: { + start: { line: 7, column: 50, offset: 190 }, + end: { line: 7, column: 65, offset: 205 }, + }, + }, + ], + position: { + start: { line: 7, column: 49, offset: 189 }, + end: { line: 7, column: 66, offset: 206 }, + }, + }, + { + type: 'text', + value: ' evolving to be the ', + position: { + start: { line: 7, column: 66, offset: 206 }, + end: { line: 7, column: 86, offset: 226 }, + }, + }, + { + type: 'strong', + children: [ + { + type: 'text', + value: 'best editor experience', + position: { + start: { line: 7, column: 88, offset: 228 }, + end: { line: 7, column: 110, offset: 250 }, + }, + }, + ], + position: { + start: { line: 7, column: 86, offset: 226 }, + end: { line: 7, column: 112, offset: 252 }, + }, + }, + { + type: 'text', + value: ' available for static site generators.', + position: { + start: { line: 7, column: 112, offset: 252 }, + end: { line: 7, column: 150, offset: 290 }, + }, + }, + ], + position: { + start: { line: 7, column: 1, offset: 141 }, + end: { line: 7, column: 150, offset: 290 }, + }, + }, + { + type: 'heading', + depth: 2, + children: [ + { + type: 'text', + value: 'MDX', + position: { + start: { line: 9, column: 4, offset: 295 }, + end: { line: 9, column: 7, offset: 298 }, + }, + }, + ], + position: { + start: { line: 9, column: 1, offset: 292 }, + end: { line: 9, column: 7, offset: 298 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'The output out this widget is ', + position: { + start: { line: 11, column: 1, offset: 300 }, + end: { line: 11, column: 31, offset: 330 }, + }, + }, + { + type: 'inlineCode', + value: 'mdx', + position: { + start: { line: 11, column: 31, offset: 330 }, + end: { line: 11, column: 36, offset: 335 }, + }, + }, + { + type: 'text', + value: ', a mixture of ', + position: { + start: { line: 11, column: 36, offset: 335 }, + end: { line: 11, column: 51, offset: 350 }, + }, + }, + { + type: 'inlineCode', + value: 'markdown', + position: { + start: { line: 11, column: 51, offset: 350 }, + end: { line: 11, column: 61, offset: 360 }, + }, + }, + { + type: 'text', + value: ' and ', + position: { + start: { line: 11, column: 61, offset: 360 }, + end: { line: 11, column: 66, offset: 365 }, + }, + }, + { + type: 'inlineCode', + value: 'javascript components', + position: { + start: { line: 11, column: 66, offset: 365 }, + end: { line: 11, column: 89, offset: 388 }, + }, + }, + { + type: 'text', + value: '. See ', + position: { + start: { line: 11, column: 89, offset: 388 }, + end: { line: 11, column: 95, offset: 394 }, + }, + }, + { + type: 'link', + title: null, + url: 'https://mdxjs.com/docs/', + children: [ + { + type: 'text', + value: 'MDX documentation', + position: { + start: { line: 11, column: 96, offset: 395 }, + end: { line: 11, column: 113, offset: 412 }, + }, + }, + ], + position: { + start: { line: 11, column: 95, offset: 394 }, + end: { line: 11, column: 139, offset: 438 }, + }, + }, + { + type: 'text', + value: '.', + position: { + start: { line: 11, column: 139, offset: 438 }, + end: { line: 11, column: 140, offset: 439 }, + }, + }, + ], + position: { + start: { line: 11, column: 1, offset: 300 }, + end: { line: 11, column: 140, offset: 439 }, + }, + }, + { + type: 'code', + lang: 'yaml', + meta: null, + value: 'name: body\nlabel: Blog post content\nwidget: markdown', + position: { + start: { line: 13, column: 1, offset: 441 }, + end: { line: 17, column: 4, offset: 505 }, + }, + }, + { + type: 'code', + lang: 'js', + meta: null, + value: "name: 'body',\nlabel: 'Blog post content',\nwidget: 'markdown',", + position: { + start: { line: 19, column: 1, offset: 507 }, + end: { line: 23, column: 4, offset: 578 }, + }, + }, + { + type: 'blockquote', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: + 'See the table below for default options\nMore API information can be found in the document', + position: { + start: { line: 25, column: 3, offset: 582 }, + end: { line: 26, column: 52, offset: 673 }, + }, + }, + ], + position: { + start: { line: 25, column: 3, offset: 582 }, + end: { line: 26, column: 52, offset: 673 }, + }, + }, + ], + position: { + start: { line: 25, column: 1, offset: 580 }, + end: { line: 26, column: 52, offset: 673 }, + }, + }, + { + type: 'table', + align: [null, null, null, null], + children: [ + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Name', + position: { + start: { line: 28, column: 2, offset: 676 }, + end: { line: 28, column: 6, offset: 680 }, + }, + }, + ], + position: { + start: { line: 28, column: 1, offset: 675 }, + end: { line: 28, column: 7, offset: 681 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Type', + position: { + start: { line: 28, column: 7, offset: 681 }, + end: { line: 28, column: 11, offset: 685 }, + }, + }, + ], + position: { + start: { line: 28, column: 7, offset: 681 }, + end: { line: 28, column: 12, offset: 686 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Default', + position: { + start: { line: 28, column: 12, offset: 686 }, + end: { line: 28, column: 19, offset: 693 }, + }, + }, + ], + position: { + start: { line: 28, column: 12, offset: 686 }, + end: { line: 28, column: 20, offset: 694 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Description', + position: { + start: { line: 28, column: 20, offset: 694 }, + end: { line: 28, column: 31, offset: 705 }, + }, + }, + ], + position: { + start: { line: 28, column: 20, offset: 694 }, + end: { line: 28, column: 32, offset: 706 }, + }, + }, + ], + position: { + start: { line: 28, column: 1, offset: 675 }, + end: { line: 28, column: 32, offset: 706 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'default', + position: { + start: { line: 30, column: 2, offset: 726 }, + end: { line: 30, column: 9, offset: 733 }, + }, + }, + ], + position: { + start: { line: 30, column: 1, offset: 725 }, + end: { line: 30, column: 10, offset: 734 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'string', + position: { + start: { line: 30, column: 10, offset: 734 }, + end: { line: 30, column: 16, offset: 740 }, + }, + }, + ], + position: { + start: { line: 30, column: 10, offset: 734 }, + end: { line: 30, column: 17, offset: 741 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'inlineCode', + value: "''", + position: { + start: { line: 30, column: 17, offset: 741 }, + end: { line: 30, column: 21, offset: 745 }, + }, + }, + ], + position: { + start: { line: 30, column: 17, offset: 741 }, + end: { line: 30, column: 22, offset: 746 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Optional', + position: { + start: { line: 30, column: 23, offset: 747 }, + end: { line: 30, column: 31, offset: 755 }, + }, + }, + ], + position: { + start: { line: 30, column: 22, offset: 746 }, + end: { line: 30, column: 32, offset: 756 }, + }, + }, + { + type: 'text', + value: '. The default value for the field. Accepts markdown content', + position: { + start: { line: 30, column: 32, offset: 756 }, + end: { line: 30, column: 91, offset: 815 }, + }, + }, + ], + position: { + start: { line: 30, column: 22, offset: 746 }, + end: { line: 30, column: 92, offset: 816 }, + }, + }, + ], + position: { + start: { line: 30, column: 1, offset: 725 }, + end: { line: 30, column: 92, offset: 816 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'media_library', + position: { + start: { line: 31, column: 2, offset: 818 }, + end: { line: 31, column: 15, offset: 831 }, + }, + }, + ], + position: { + start: { line: 31, column: 1, offset: 817 }, + end: { line: 31, column: 16, offset: 832 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Media Library Options', + position: { + start: { line: 31, column: 16, offset: 832 }, + end: { line: 31, column: 37, offset: 853 }, + }, + }, + ], + position: { + start: { line: 31, column: 16, offset: 832 }, + end: { line: 31, column: 38, offset: 854 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'inlineCode', + value: '{}', + position: { + start: { line: 31, column: 38, offset: 854 }, + end: { line: 31, column: 42, offset: 858 }, + }, + }, + ], + position: { + start: { line: 31, column: 38, offset: 854 }, + end: { line: 31, column: 43, offset: 859 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Optional', + position: { + start: { line: 31, column: 44, offset: 860 }, + end: { line: 31, column: 52, offset: 868 }, + }, + }, + ], + position: { + start: { line: 31, column: 43, offset: 859 }, + end: { line: 31, column: 53, offset: 869 }, + }, + }, + { + type: 'text', + value: + '. Media library settings to apply when a media library is opened by the current widget. See ', + position: { + start: { line: 31, column: 53, offset: 869 }, + end: { line: 31, column: 145, offset: 961 }, + }, + }, + { + type: 'link', + title: null, + url: '#media-library-options', + children: [ + { + type: 'text', + value: 'Media Library Options', + position: { + start: { line: 31, column: 146, offset: 962 }, + end: { line: 31, column: 167, offset: 983 }, + }, + }, + ], + position: { + start: { line: 31, column: 145, offset: 961 }, + end: { line: 31, column: 192, offset: 1008 }, + }, + }, + ], + position: { + start: { line: 31, column: 43, offset: 859 }, + end: { line: 31, column: 193, offset: 1009 }, + }, + }, + ], + position: { + start: { line: 31, column: 1, offset: 817 }, + end: { line: 31, column: 193, offset: 1009 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'media_folder', + position: { + start: { line: 32, column: 2, offset: 1011 }, + end: { line: 32, column: 14, offset: 1023 }, + }, + }, + ], + position: { + start: { line: 32, column: 1, offset: 1010 }, + end: { line: 32, column: 15, offset: 1024 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'string', + position: { + start: { line: 32, column: 15, offset: 1024 }, + end: { line: 32, column: 21, offset: 1030 }, + }, + }, + ], + position: { + start: { line: 32, column: 15, offset: 1024 }, + end: { line: 32, column: 22, offset: 1031 }, + }, + }, + { + type: 'tableCell', + children: [], + position: { + start: { line: 32, column: 22, offset: 1031 }, + end: { line: 32, column: 24, offset: 1033 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Optional', + position: { + start: { line: 32, column: 25, offset: 1034 }, + end: { line: 32, column: 33, offset: 1042 }, + }, + }, + ], + position: { + start: { line: 32, column: 24, offset: 1033 }, + end: { line: 32, column: 34, offset: 1043 }, + }, + }, + { + type: 'text', + value: + '. Specifies the folder path where uploaded files should be saved, relative to the base of the repo', + position: { + start: { line: 32, column: 34, offset: 1043 }, + end: { line: 32, column: 132, offset: 1141 }, + }, + }, + ], + position: { + start: { line: 32, column: 24, offset: 1033 }, + end: { line: 32, column: 133, offset: 1142 }, + }, + }, + ], + position: { + start: { line: 32, column: 1, offset: 1010 }, + end: { line: 32, column: 133, offset: 1142 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'public_folder', + position: { + start: { line: 33, column: 2, offset: 1144 }, + end: { line: 33, column: 15, offset: 1157 }, + }, + }, + ], + position: { + start: { line: 33, column: 1, offset: 1143 }, + end: { line: 33, column: 16, offset: 1158 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'string', + position: { + start: { line: 33, column: 16, offset: 1158 }, + end: { line: 33, column: 22, offset: 1164 }, + }, + }, + ], + position: { + start: { line: 33, column: 16, offset: 1158 }, + end: { line: 33, column: 23, offset: 1165 }, + }, + }, + { + type: 'tableCell', + children: [], + position: { + start: { line: 33, column: 23, offset: 1165 }, + end: { line: 33, column: 25, offset: 1167 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Optional', + position: { + start: { line: 33, column: 26, offset: 1168 }, + end: { line: 33, column: 34, offset: 1176 }, + }, + }, + ], + position: { + start: { line: 33, column: 25, offset: 1167 }, + end: { line: 33, column: 35, offset: 1177 }, + }, + }, + { + type: 'text', + value: + '. Specifies the folder path where the files uploaded by the media library will be accessed, relative to the base of the built site', + position: { + start: { line: 33, column: 35, offset: 1177 }, + end: { line: 33, column: 165, offset: 1307 }, + }, + }, + ], + position: { + start: { line: 33, column: 25, offset: 1167 }, + end: { line: 33, column: 166, offset: 1308 }, + }, + }, + ], + position: { + start: { line: 33, column: 1, offset: 1143 }, + end: { line: 33, column: 166, offset: 1308 }, + }, + }, + ], + position: { + start: { line: 28, column: 1, offset: 675 }, + end: { line: 33, column: 166, offset: 1308 }, + }, + }, + { + type: 'heading', + depth: 3, + children: [ + { + type: 'text', + value: 'Media Library Options', + position: { + start: { line: 35, column: 5, offset: 1314 }, + end: { line: 35, column: 26, offset: 1335 }, + }, + }, + ], + position: { + start: { line: 35, column: 1, offset: 1310 }, + end: { line: 35, column: 26, offset: 1335 }, + }, + }, + { + type: 'table', + align: [null, null, null, null], + children: [ + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Name', + position: { + start: { line: 37, column: 2, offset: 1338 }, + end: { line: 37, column: 6, offset: 1342 }, + }, + }, + ], + position: { + start: { line: 37, column: 1, offset: 1337 }, + end: { line: 37, column: 7, offset: 1343 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Type', + position: { + start: { line: 37, column: 7, offset: 1343 }, + end: { line: 37, column: 11, offset: 1347 }, + }, + }, + ], + position: { + start: { line: 37, column: 7, offset: 1343 }, + end: { line: 37, column: 12, offset: 1348 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Default', + position: { + start: { line: 37, column: 12, offset: 1348 }, + end: { line: 37, column: 19, offset: 1355 }, + }, + }, + ], + position: { + start: { line: 37, column: 12, offset: 1348 }, + end: { line: 37, column: 20, offset: 1356 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'Description', + position: { + start: { line: 37, column: 20, offset: 1356 }, + end: { line: 37, column: 31, offset: 1367 }, + }, + }, + ], + position: { + start: { line: 37, column: 20, offset: 1356 }, + end: { line: 37, column: 32, offset: 1368 }, + }, + }, + ], + position: { + start: { line: 37, column: 1, offset: 1337 }, + end: { line: 37, column: 32, offset: 1368 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'allow_multiple', + position: { + start: { line: 39, column: 2, offset: 1388 }, + end: { line: 39, column: 16, offset: 1402 }, + }, + }, + ], + position: { + start: { line: 39, column: 1, offset: 1387 }, + end: { line: 39, column: 17, offset: 1403 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'boolean', + position: { + start: { line: 39, column: 17, offset: 1403 }, + end: { line: 39, column: 24, offset: 1410 }, + }, + }, + ], + position: { + start: { line: 39, column: 17, offset: 1403 }, + end: { line: 39, column: 25, offset: 1411 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'inlineCode', + value: 'true', + position: { + start: { line: 39, column: 25, offset: 1411 }, + end: { line: 39, column: 31, offset: 1417 }, + }, + }, + ], + position: { + start: { line: 39, column: 25, offset: 1411 }, + end: { line: 39, column: 32, offset: 1418 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Optional', + position: { + start: { line: 39, column: 33, offset: 1419 }, + end: { line: 39, column: 41, offset: 1427 }, + }, + }, + ], + position: { + start: { line: 39, column: 32, offset: 1418 }, + end: { line: 39, column: 42, offset: 1428 }, + }, + }, + { + type: 'text', + value: '. When set to ', + position: { + start: { line: 39, column: 42, offset: 1428 }, + end: { line: 39, column: 56, offset: 1442 }, + }, + }, + { + type: 'inlineCode', + value: 'false', + position: { + start: { line: 39, column: 56, offset: 1442 }, + end: { line: 39, column: 63, offset: 1449 }, + }, + }, + { + type: 'text', + value: + ', prevents multiple selection for any media library extension, but must be supported by the extension in use', + position: { + start: { line: 39, column: 63, offset: 1449 }, + end: { line: 39, column: 171, offset: 1557 }, + }, + }, + ], + position: { + start: { line: 39, column: 32, offset: 1418 }, + end: { line: 39, column: 172, offset: 1558 }, + }, + }, + ], + position: { + start: { line: 39, column: 1, offset: 1387 }, + end: { line: 39, column: 172, offset: 1558 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'config', + position: { + start: { line: 40, column: 2, offset: 1560 }, + end: { line: 40, column: 8, offset: 1566 }, + }, + }, + ], + position: { + start: { line: 40, column: 1, offset: 1559 }, + end: { line: 40, column: 9, offset: 1567 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'string', + position: { + start: { line: 40, column: 9, offset: 1567 }, + end: { line: 40, column: 15, offset: 1573 }, + }, + }, + ], + position: { + start: { line: 40, column: 9, offset: 1567 }, + end: { line: 40, column: 16, offset: 1574 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'inlineCode', + value: '{}', + position: { + start: { line: 40, column: 16, offset: 1574 }, + end: { line: 40, column: 20, offset: 1578 }, + }, + }, + ], + position: { + start: { line: 40, column: 16, offset: 1574 }, + end: { line: 40, column: 21, offset: 1579 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Optional', + position: { + start: { line: 40, column: 22, offset: 1580 }, + end: { line: 40, column: 30, offset: 1588 }, + }, + }, + ], + position: { + start: { line: 40, column: 21, offset: 1579 }, + end: { line: 40, column: 31, offset: 1589 }, + }, + }, + { + type: 'text', + value: + '. A configuration object that will be passed directly to the media library being used - available options are determined by the library', + position: { + start: { line: 40, column: 31, offset: 1589 }, + end: { line: 40, column: 166, offset: 1724 }, + }, + }, + ], + position: { + start: { line: 40, column: 21, offset: 1579 }, + end: { line: 40, column: 167, offset: 1725 }, + }, + }, + ], + position: { + start: { line: 40, column: 1, offset: 1559 }, + end: { line: 40, column: 167, offset: 1725 }, + }, + }, + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'choose_url', + position: { + start: { line: 41, column: 2, offset: 1727 }, + end: { line: 41, column: 12, offset: 1737 }, + }, + }, + ], + position: { + start: { line: 41, column: 1, offset: 1726 }, + end: { line: 41, column: 13, offset: 1738 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'text', + value: 'string', + position: { + start: { line: 41, column: 13, offset: 1738 }, + end: { line: 41, column: 19, offset: 1744 }, + }, + }, + { + type: 'html', + value: '
', + position: { + start: { line: 41, column: 19, offset: 1744 }, + end: { line: 41, column: 25, offset: 1750 }, + }, + }, + { + type: 'text', + value: '| boolean', + position: { + start: { line: 41, column: 25, offset: 1750 }, + end: { line: 41, column: 35, offset: 1760 }, + }, + }, + ], + position: { + start: { line: 41, column: 13, offset: 1738 }, + end: { line: 41, column: 36, offset: 1761 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'inlineCode', + value: 'true', + position: { + start: { line: 41, column: 36, offset: 1761 }, + end: { line: 41, column: 42, offset: 1767 }, + }, + }, + ], + position: { + start: { line: 41, column: 36, offset: 1761 }, + end: { line: 41, column: 43, offset: 1768 }, + }, + }, + { + type: 'tableCell', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Optional', + position: { + start: { line: 41, column: 44, offset: 1769 }, + end: { line: 41, column: 52, offset: 1777 }, + }, + }, + ], + position: { + start: { line: 41, column: 43, offset: 1768 }, + end: { line: 41, column: 53, offset: 1778 }, + }, + }, + { + type: 'text', + value: '. When set to ', + position: { + start: { line: 41, column: 53, offset: 1778 }, + end: { line: 41, column: 67, offset: 1792 }, + }, + }, + { + type: 'inlineCode', + value: 'false', + position: { + start: { line: 41, column: 67, offset: 1792 }, + end: { line: 41, column: 74, offset: 1799 }, + }, + }, + { + type: 'text', + value: ', the "Insert from URL" button will be hidden', + position: { + start: { line: 41, column: 74, offset: 1799 }, + end: { line: 41, column: 119, offset: 1844 }, + }, + }, + ], + position: { + start: { line: 41, column: 43, offset: 1768 }, + end: { line: 41, column: 120, offset: 1845 }, + }, + }, + ], + position: { + start: { line: 41, column: 1, offset: 1726 }, + end: { line: 41, column: 120, offset: 1845 }, + }, + }, + ], + position: { + start: { line: 37, column: 1, offset: 1337 }, + end: { line: 41, column: 120, offset: 1845 }, + }, + }, + { + type: 'heading', + depth: 2, + children: [ + { + type: 'text', + value: 'Features', + position: { + start: { line: 43, column: 4, offset: 1850 }, + end: { line: 43, column: 12, offset: 1858 }, + }, + }, + ], + position: { + start: { line: 43, column: 1, offset: 1847 }, + end: { line: 43, column: 12, offset: 1858 }, + }, + }, + { + type: 'list', + ordered: false, + start: null, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'CommonMark + GFM Specifications', + position: { + start: { line: 45, column: 3, offset: 1862 }, + end: { line: 45, column: 34, offset: 1893 }, + }, + }, + ], + position: { + start: { line: 45, column: 3, offset: 1862 }, + end: { line: 45, column: 34, offset: 1893 }, + }, + }, + { + type: 'list', + ordered: false, + start: null, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Live ', + position: { + start: { line: 46, column: 5, offset: 1898 }, + end: { line: 46, column: 10, offset: 1903 }, + }, + }, + { + type: 'inlineCode', + value: 'Preview', + position: { + start: { line: 46, column: 10, offset: 1903 }, + end: { line: 46, column: 19, offset: 1912 }, + }, + }, + ], + position: { + start: { line: 46, column: 5, offset: 1898 }, + end: { line: 46, column: 19, offset: 1912 }, + }, + }, + ], + position: { + start: { line: 46, column: 3, offset: 1896 }, + end: { line: 46, column: 19, offset: 1912 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Auto Indent', + position: { + start: { line: 47, column: 5, offset: 1917 }, + end: { line: 47, column: 16, offset: 1928 }, + }, + }, + ], + position: { + start: { line: 47, column: 5, offset: 1917 }, + end: { line: 47, column: 16, offset: 1928 }, + }, + }, + ], + position: { + start: { line: 47, column: 3, offset: 1915 }, + end: { line: 47, column: 16, offset: 1928 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Syntax Highlight', + position: { + start: { line: 48, column: 5, offset: 1933 }, + end: { line: 48, column: 21, offset: 1949 }, + }, + }, + ], + position: { + start: { line: 48, column: 5, offset: 1933 }, + end: { line: 48, column: 21, offset: 1949 }, + }, + }, + { + type: 'list', + ordered: true, + start: 1, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Rich Editor', + position: { + start: { line: 49, column: 10, offset: 1959 }, + end: { line: 49, column: 21, offset: 1970 }, + }, + }, + ], + position: { + start: { line: 49, column: 10, offset: 1959 }, + end: { line: 49, column: 21, offset: 1970 }, + }, + }, + ], + position: { + start: { line: 49, column: 7, offset: 1956 }, + end: { line: 49, column: 21, offset: 1970 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Preview', + position: { + start: { line: 50, column: 10, offset: 1980 }, + end: { line: 50, column: 17, offset: 1987 }, + }, + }, + ], + position: { + start: { line: 50, column: 10, offset: 1980 }, + end: { line: 50, column: 17, offset: 1987 }, + }, + }, + ], + position: { + start: { line: 50, column: 7, offset: 1977 }, + end: { line: 50, column: 17, offset: 1987 }, + }, + }, + ], + position: { + start: { line: 49, column: 7, offset: 1956 }, + end: { line: 50, column: 17, offset: 1987 }, + }, + }, + ], + position: { + start: { line: 48, column: 3, offset: 1931 }, + end: { line: 50, column: 17, offset: 1987 }, + }, + }, + ], + position: { + start: { line: 46, column: 3, offset: 1896 }, + end: { line: 50, column: 17, offset: 1987 }, + }, + }, + ], + position: { + start: { line: 45, column: 1, offset: 1860 }, + end: { line: 50, column: 17, offset: 1987 }, + }, + }, + ], + position: { + start: { line: 45, column: 1, offset: 1860 }, + end: { line: 50, column: 17, offset: 1987 }, + }, + }, + { + type: 'heading', + depth: 2, + children: [ + { + type: 'text', + value: 'Formatting', + position: { + start: { line: 52, column: 4, offset: 1992 }, + end: { line: 52, column: 14, offset: 2002 }, + }, + }, + ], + position: { + start: { line: 52, column: 1, offset: 1989 }, + end: { line: 52, column: 14, offset: 2002 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'strong', + children: [ + { + type: 'text', + value: 'Bold', + position: { + start: { line: 54, column: 3, offset: 2006 }, + end: { line: 54, column: 7, offset: 2010 }, + }, + }, + ], + position: { + start: { line: 54, column: 1, offset: 2004 }, + end: { line: 54, column: 9, offset: 2012 }, + }, + }, + { + type: 'text', + value: ', ', + position: { + start: { line: 54, column: 9, offset: 2012 }, + end: { line: 54, column: 11, offset: 2014 }, + }, + }, + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Italic', + position: { + start: { line: 54, column: 12, offset: 2015 }, + end: { line: 54, column: 18, offset: 2021 }, + }, + }, + ], + position: { + start: { line: 54, column: 11, offset: 2014 }, + end: { line: 54, column: 19, offset: 2022 }, + }, + }, + { + type: 'text', + value: ', ', + position: { + start: { line: 54, column: 19, offset: 2022 }, + end: { line: 54, column: 21, offset: 2024 }, + }, + }, + { + type: 'emphasis', + children: [ + { + type: 'strong', + children: [ + { + type: 'text', + value: 'both', + position: { + start: { line: 54, column: 24, offset: 2027 }, + end: { line: 54, column: 28, offset: 2031 }, + }, + }, + ], + position: { + start: { line: 54, column: 22, offset: 2025 }, + end: { line: 54, column: 30, offset: 2033 }, + }, + }, + ], + position: { + start: { line: 54, column: 21, offset: 2024 }, + end: { line: 54, column: 31, offset: 2034 }, + }, + }, + ], + position: { + start: { line: 54, column: 1, offset: 2004 }, + end: { line: 54, column: 31, offset: 2034 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'delete', + children: [ + { + type: 'text', + value: 'Strikethrough', + position: { + start: { line: 56, column: 3, offset: 2038 }, + end: { line: 56, column: 16, offset: 2051 }, + }, + }, + ], + position: { + start: { line: 56, column: 1, offset: 2036 }, + end: { line: 56, column: 18, offset: 2053 }, + }, + }, + ], + position: { + start: { line: 56, column: 1, offset: 2036 }, + end: { line: 56, column: 18, offset: 2053 }, + }, + }, + { + type: 'heading', + depth: 2, + children: [ + { + type: 'text', + value: 'Shortcodes', + position: { + start: { line: 58, column: 4, offset: 2058 }, + end: { line: 58, column: 14, offset: 2068 }, + }, + }, + ], + position: { + start: { line: 58, column: 1, offset: 2055 }, + end: { line: 58, column: 14, offset: 2068 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Text ahead [youtube|p6h-rYSVX90] and behind', + position: { + start: { line: 60, column: 1, offset: 2070 }, + end: { line: 60, column: 44, offset: 2113 }, + }, + }, + ], + position: { + start: { line: 60, column: 1, offset: 2070 }, + end: { line: 60, column: 44, offset: 2113 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'text', + value: '{{< twitter 917359331535966209 >}} Only behind text', + position: { + start: { line: 62, column: 1, offset: 2115 }, + end: { line: 62, column: 52, offset: 2166 }, + }, + }, + ], + position: { + start: { line: 62, column: 1, offset: 2115 }, + end: { line: 62, column: 52, offset: 2166 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Only text before {{< twitter 917359331535966209 >}}', + position: { + start: { line: 64, column: 1, offset: 2168 }, + end: { line: 64, column: 52, offset: 2219 }, + }, + }, + ], + position: { + start: { line: 64, column: 1, offset: 2168 }, + end: { line: 64, column: 52, offset: 2219 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'text', + value: '[youtube|p6h-rYSVX90]', + position: { + start: { line: 66, column: 1, offset: 2221 }, + end: { line: 66, column: 22, offset: 2242 }, + }, + }, + ], + position: { + start: { line: 66, column: 1, offset: 2221 }, + end: { line: 66, column: 22, offset: 2242 }, + }, + }, + { + type: 'paragraph', + children: [ + { + type: 'text', + value: + 'Text ahead [youtube|p6h-rYSVX90] and behind and another {{< twitter 917359331535966209 >}} shortcode', + position: { + start: { line: 68, column: 1, offset: 2244 }, + end: { line: 68, column: 101, offset: 2344 }, + }, + }, + ], + position: { + start: { line: 68, column: 1, offset: 2244 }, + end: { line: 68, column: 101, offset: 2344 }, + }, + }, + { + type: 'heading', + depth: 2, + children: [ + { + type: 'text', + value: 'Support', + position: { + start: { line: 70, column: 4, offset: 2349 }, + end: { line: 70, column: 11, offset: 2356 }, + }, + }, + ], + position: { + start: { line: 70, column: 1, offset: 2346 }, + end: { line: 70, column: 11, offset: 2356 }, + }, + }, + { + type: 'blockquote', + children: [ + { + type: 'list', + ordered: false, + start: null, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Supports remark plugins', + position: { + start: { line: 72, column: 5, offset: 2362 }, + end: { line: 72, column: 28, offset: 2385 }, + }, + }, + ], + position: { + start: { line: 72, column: 5, offset: 2362 }, + end: { line: 72, column: 28, offset: 2385 }, + }, + }, + ], + position: { + start: { line: 72, column: 3, offset: 2360 }, + end: { line: 72, column: 28, offset: 2385 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: null, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'Supports wrappers', + position: { + start: { line: 73, column: 5, offset: 2390 }, + end: { line: 73, column: 22, offset: 2407 }, + }, + }, + ], + position: { + start: { line: 73, column: 5, offset: 2390 }, + end: { line: 73, column: 22, offset: 2407 }, + }, + }, + { + type: 'list', + ordered: true, + start: 1, + spread: false, + children: [ + { + type: 'listItem', + spread: false, + checked: true, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'React', + position: { + start: { line: 74, column: 13, offset: 2420 }, + end: { line: 74, column: 18, offset: 2425 }, + }, + }, + ], + position: { + start: { line: 74, column: 13, offset: 2420 }, + end: { line: 74, column: 18, offset: 2425 }, + }, + }, + ], + position: { + start: { line: 74, column: 6, offset: 2413 }, + end: { line: 74, column: 18, offset: 2425 }, + }, + }, + { + type: 'listItem', + spread: false, + checked: false, + children: [ + { + type: 'paragraph', + children: [ + { + type: 'text', + value: 'More coming soon', + position: { + start: { line: 75, column: 13, offset: 2438 }, + end: { line: 75, column: 29, offset: 2454 }, + }, + }, + ], + position: { + start: { line: 75, column: 13, offset: 2438 }, + end: { line: 75, column: 29, offset: 2454 }, + }, + }, + ], + position: { + start: { line: 75, column: 6, offset: 2431 }, + end: { line: 75, column: 29, offset: 2454 }, + }, + }, + ], + position: { + start: { line: 74, column: 6, offset: 2413 }, + end: { line: 75, column: 29, offset: 2454 }, + }, + }, + ], + position: { + start: { line: 73, column: 3, offset: 2388 }, + end: { line: 75, column: 29, offset: 2454 }, + }, + }, + ], + position: { + start: { line: 72, column: 3, offset: 2360 }, + end: { line: 75, column: 29, offset: 2454 }, + }, + }, + ], + position: { + start: { line: 72, column: 1, offset: 2358 }, + end: { line: 75, column: 29, offset: 2454 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 75, column: 29, offset: 2454 }, + }, + }, slate: [ { type: 'h1', @@ -2718,102 +6961,354 @@ Text ahead [youtube|p6h-rYSVX90] and behind and another {{< twitter 917359331535 export const deserializationOnlyTestData: SerializationTests = { italic: { - 'italic (using *)': { - markdown: '*Italic*', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + 'italic (using *)': { + markdown: '*Italic*', + mdast: { + type: 'root', children: [ { - italic: true, - text: 'Italic', + type: 'paragraph', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Italic', + position: { + start: { line: 1, column: 2, offset: 1 }, + end: { line: 1, column: 8, offset: 7 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + italic: true, + text: 'Italic', + }, + ], + }, + ], + }, }, }, bold: { - 'bold (using __)': { - markdown: '__Bold__', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + 'bold (using __)': { + markdown: '__Bold__', + mdast: { + type: 'root', children: [ { - bold: true, - text: 'Bold', + type: 'paragraph', + children: [ + { + type: 'strong', + children: [ + { + type: 'text', + value: 'Bold', + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 7, offset: 6 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 9, offset: 8 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + bold: true, + text: 'Bold', + }, + ], + }, + ], + }, }, }, 'bold and italic': { - 'bold and italic (using ___)': { - markdown: '___Bold and Italic___', - slate: [ - { - type: ELEMENT_PARAGRAPH, + both: { + 'bold and italic (using ___)': { + markdown: '___Bold and Italic___', + mdast: { + type: 'root', children: [ { - bold: true, - italic: true, - text: 'Bold and Italic', + type: 'paragraph', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'strong', + children: [ + { + type: 'text', + value: 'Bold and Italic', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 19, offset: 18 }, + }, + }, + ], + position: { + start: { line: 1, column: 2, offset: 1 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + bold: true, + italic: true, + text: 'Bold and Italic', + }, + ], + }, + ], + }, - 'bold and italic (using **_)': { - markdown: '**_Bold and Italic_**', - slate: [ - { - type: ELEMENT_PARAGRAPH, + 'bold and italic (using **_)': { + markdown: '**_Bold and Italic_**', + mdast: { + type: 'root', children: [ { - bold: true, - italic: true, - text: 'Bold and Italic', + type: 'paragraph', + children: [ + { + type: 'strong', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Bold and Italic', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 19, offset: 18 }, + }, + }, + ], + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 20, offset: 19 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + bold: true, + italic: true, + text: 'Bold and Italic', + }, + ], + }, + ], + }, - 'bold and italic (using __*)': { - markdown: '__*Bold and Italic*__', - slate: [ - { - type: ELEMENT_PARAGRAPH, + 'bold and italic (using __*)': { + markdown: '__*Bold and Italic*__', + mdast: { + type: 'root', children: [ { - bold: true, - italic: true, - text: 'Bold and Italic', + type: 'paragraph', + children: [ + { + type: 'strong', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'text', + value: 'Bold and Italic', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 19, offset: 18 }, + }, + }, + ], + position: { + start: { line: 1, column: 3, offset: 2 }, + end: { line: 1, column: 20, offset: 19 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, }, - ], - }, + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + bold: true, + italic: true, + text: 'Bold and Italic', + }, + ], + }, + ], + }, - 'bold and italic (using *__)': { - markdown: '*__Bold and Italic__*', - slate: [ - { - type: ELEMENT_PARAGRAPH, + 'bold and italic (using *__)': { + markdown: '*__Bold and Italic__*', + mdast: { + type: 'root', children: [ { - bold: true, - italic: true, - text: 'Bold and Italic', + type: 'paragraph', + children: [ + { + type: 'emphasis', + children: [ + { + type: 'strong', + children: [ + { + type: 'text', + value: 'Bold and Italic', + position: { + start: { line: 1, column: 4, offset: 3 }, + end: { line: 1, column: 19, offset: 18 }, + }, + }, + ], + position: { + start: { line: 1, column: 2, offset: 1 }, + end: { line: 1, column: 21, offset: 20 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, }, ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 22, offset: 21 }, + }, }, - ], + slate: [ + { + type: ELEMENT_PARAGRAPH, + children: [ + { + bold: true, + italic: true, + text: 'Bold and Italic', + }, + ], + }, + ], + }, }, }, @@ -2821,6 +7316,43 @@ export const deserializationOnlyTestData: SerializationTests = { mdx: { 'color attribute of font tag': { markdown: 'Colored Text', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'font', + attributes: [{ type: 'mdxJsxAttribute', name: 'color', value: 'red' }], + children: [ + { + type: 'text', + value: 'Colored Text', + position: { + start: { line: 1, column: 19, offset: 18 }, + end: { line: 1, column: 31, offset: 30 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 38, offset: 37 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 38, offset: 37 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 38, offset: 37 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -2837,6 +7369,53 @@ export const deserializationOnlyTestData: SerializationTests = { 'color and style attributes of font tag together (favoring color)': { markdown: "Colored Text", + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'font', + attributes: [ + { type: 'mdxJsxAttribute', name: 'color', value: 'blue' }, + { + type: 'mdxJsxAttribute', + name: 'style', + value: { + type: 'mdxJsxAttributeValueExpression', + value: "{ color: 'red', backgroundColor: 'black' }", + }, + }, + ], + children: [ + { + type: 'text', + value: 'Colored Text', + position: { + start: { line: 1, column: 71, offset: 70 }, + end: { line: 1, column: 83, offset: 82 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 90, offset: 89 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 90, offset: 89 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 90, offset: 89 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -2857,6 +7436,43 @@ export const deserializationOnlyTestData: SerializationTests = { mdx: { 'align attribute of paragraph tag': { markdown: '

Aligned Left

', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'p', + attributes: [{ type: 'mdxJsxAttribute', name: 'align', value: 'left' }], + children: [ + { + type: 'text', + value: 'Aligned Left', + position: { + start: { line: 1, column: 17, offset: 16 }, + end: { line: 1, column: 29, offset: 28 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 33, offset: 32 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 33, offset: 32 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 33, offset: 32 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -2872,6 +7488,53 @@ export const deserializationOnlyTestData: SerializationTests = { 'align and style attributes of font paragraph together (favoring align)': { markdown: '

Aligned Center

', + mdast: { + type: 'root', + children: [ + { + type: 'paragraph', + children: [ + { + type: 'mdxJsxTextElement', + name: 'p', + attributes: [ + { type: 'mdxJsxAttribute', name: 'align', value: 'center' }, + { + type: 'mdxJsxAttribute', + name: 'style', + value: { + type: 'mdxJsxAttributeValueExpression', + value: "{ textAlign: 'center' }", + }, + }, + ], + children: [ + { + type: 'text', + value: 'Aligned Center', + position: { + start: { line: 1, column: 51, offset: 50 }, + end: { line: 1, column: 65, offset: 64 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 69, offset: 68 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 69, offset: 68 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 69, offset: 68 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -2891,6 +7554,25 @@ export const deserializationOnlyTestData: SerializationTests = { mdx: { 'break tag': { markdown: '
', + mdast: { + type: 'root', + children: [ + { + type: 'mdxJsxFlowElement', + name: 'br', + attributes: [], + children: [], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 7, offset: 6 }, + }, + }, + ], + position: { + start: { line: 1, column: 1, offset: 0 }, + end: { line: 1, column: 7, offset: 6 }, + }, + }, slate: [ { type: ELEMENT_PARAGRAPH, @@ -2932,23 +7614,13 @@ export function runSerializationTests( Object.keys(testData).forEach(key => { const data = testData[key]; - if (isSerializationTest(data)) { - testCallback(key, 'both', data); - return; - } - - if (isSerializationMarkdownMdxSplitTests(data)) { - describe(key, () => { - if (data.markdown) { - runSectionSerializationTests('markdown', 'markdown', data.markdown, testCallback); - } - if (data.mdx) { - runSectionSerializationTests('mdx', 'mdx', data.mdx, testCallback); - } - }); - return; - } - - runSectionSerializationTests(key, 'both', data, testCallback); + describe(key, () => { + if (data.markdown) { + runSectionSerializationTests('markdown', 'markdown', data.markdown, testCallback); + } + if (data.mdx) { + runSectionSerializationTests('mdx', 'mdx', data.mdx, testCallback); + } + }); }); } diff --git a/core/yarn.lock b/core/yarn.lock index 5113d491..bba24b59 100644 --- a/core/yarn.lock +++ b/core/yarn.lock @@ -1098,9 +1098,9 @@ "@lezer/java" "^1.0.0" "@codemirror/lang-javascript@^6.0.0", "@codemirror/lang-javascript@~6.1.0": - version "6.1.1" - resolved "https://registry.yarnpkg.com/@codemirror/lang-javascript/-/lang-javascript-6.1.1.tgz#f920192db30531927a02b8a1af9cf3c3d895101c" - integrity sha512-F4+kiuC5d5dUSJmff96tJQwpEXs/tX/4bapMRnZWW6bHKK1Fx6MunTzopkCUWRa9bF87GPmb9m7Qtg7Yv8f3uQ== + version "6.1.2" + resolved "https://registry.yarnpkg.com/@codemirror/lang-javascript/-/lang-javascript-6.1.2.tgz#a11812ca1d21301cdeb80e51b4c007edcf55f813" + integrity sha512-OcwLfZXdQ1OHrLiIcKCn7MqZ7nx205CMKlhe+vL88pe2ymhT9+2P+QhwkYGxMICj8TDHyp8HFKVwpiisUT7iEQ== dependencies: "@codemirror/autocomplete" "^6.0.0" "@codemirror/language" "^6.0.0" @@ -1272,10 +1272,10 @@ "@codemirror/view" "^6.0.0" "@lezer/highlight" "^1.0.0" -"@codemirror/view@6.6.0", "@codemirror/view@^6.0.0", "@codemirror/view@^6.2.2", "@codemirror/view@^6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@codemirror/view/-/view-6.6.0.tgz#d89a24912ae2f4b9d7bd430c7804c25c5e32838c" - integrity sha512-40VaFVZI3rkyjO5GHFAbNwaW+YgZexjKyx5gxLU2DvfuXAEZX0kW0apOXb0SBRLnKIQJ+U/n2nPfxgBVFHERrg== +"@codemirror/view@6.7.1", "@codemirror/view@^6.0.0", "@codemirror/view@^6.2.2", "@codemirror/view@^6.6.0": + version "6.7.1" + resolved "https://registry.yarnpkg.com/@codemirror/view/-/view-6.7.1.tgz#370e95d6f001e7f5cadc459807974b4f0a6eb225" + integrity sha512-kYtS+uqYw/q/0ytYxpkqE1JVuK5NsbmBklWYhwLFTKO9gVuTdh/kDEeZPKorbqHcJ+P+ucrhcsS1czVweOpT2g== dependencies: "@codemirror/state" "^6.1.4" style-mod "^4.0.0" @@ -1343,20 +1343,13 @@ "@dnd-kit/utilities" "^3.2.0" tslib "^2.0.0" -"@dnd-kit/utilities@3.2.1", "@dnd-kit/utilities@^3.2.1": +"@dnd-kit/utilities@3.2.1", "@dnd-kit/utilities@^3.2.0", "@dnd-kit/utilities@^3.2.1": version "3.2.1" resolved "https://registry.yarnpkg.com/@dnd-kit/utilities/-/utilities-3.2.1.tgz#53f9e2016fd2506ec49e404c289392cfff30332a" integrity sha512-OOXqISfvBw/1REtkSK2N3Fi2EQiLMlWUlqnOK/UpOISqBZPWpE6TqL+jcPtMOkE8TqYGiURvRdPSI9hltNUjEA== dependencies: tslib "^2.0.0" -"@dnd-kit/utilities@^3.2.0": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@dnd-kit/utilities/-/utilities-3.2.0.tgz#b3e956ea63a1347c9d0e1316b037ddcc6140acda" - integrity sha512-h65/pn2IPCCIWwdlR2BMLqRkDxpTEONA+HQW3n765HBijLYGyrnTCLa2YQt8VVjjSQD6EfFlTE6aS2Q/b6nb2g== - dependencies: - tslib "^2.0.0" - "@emoji-mart/data@^1.0.8": version "1.0.8" resolved "https://registry.yarnpkg.com/@emoji-mart/data/-/data-1.0.8.tgz#07f9603878b9a813ba16a6ebbabd8515f3d1b91d" @@ -2187,9 +2180,9 @@ fastq "^1.6.0" "@petamoriken/float16@^3.4.7": - version "3.6.6" - resolved "https://registry.yarnpkg.com/@petamoriken/float16/-/float16-3.6.6.tgz#641f73913a6be402b34e4bdfca98d6832ed55586" - integrity sha512-3MUulwMtsdCA9lw8a/Kc0XDBJJVCkYTQ5aGd+///TbfkOMXoOGAzzoiYKwPEsLYZv7He7fKJ/mCacqKOO7REyg== + version "3.7.0" + resolved "https://registry.yarnpkg.com/@petamoriken/float16/-/float16-3.7.0.tgz#92c7a1015fcbbf3b33b332654e402cc23d232a09" + integrity sha512-g7w35q4bt7MoM3nZKrk5COiIO+qevZjjS7bJO5pYrB0ZKABUXFBOgr2VBY66LmeI3FzkH5AZ+1uNmNHYjeuUjQ== "@pkgr/utils@^2.3.1": version "2.3.1" @@ -2612,9 +2605,9 @@ form-data "^3.0.0" "@types/node@*": - version "18.11.10" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.10.tgz#4c64759f3c2343b7e6c4b9caf761c7a3a05cee34" - integrity sha512-juG3RWMBOqcOuXC643OAdSA525V44cVgGV6dUDuiFtss+8Fk5x1hI93Rsld43VeJVIeqlP9I7Fn9/qaVqoEAuQ== + version "18.11.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.13.tgz#dff34f226ec1ac0432ae3b136ec5552bd3b9c0fe" + integrity sha512-IASpMGVcWpUsx5xBOrxMj7Bl8lqfuTY7FKAnPmu5cHkfQVWF8GulWS1jbRqA934qZL35xh5xN/+Xe/i26Bod4w== "@types/node@16.18.8": version "16.18.8" @@ -2806,9 +2799,9 @@ integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== "@types/yargs@^17.0.8": - version "17.0.15" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.15.tgz#5b62c89fb049e2fc8378394a2861a593055f0866" - integrity sha512-ZHc4W2dnEQPfhn06TBEdWaiUHEZAocYaiVMfwOipY5jcJt/251wVrKCBWBetGZWO5CF8tdb7L3DmdxVlZ2BOIg== + version "17.0.17" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.17.tgz#5672e5621f8e0fca13f433a8017aae4b7a2a03e7" + integrity sha512-72bWxFKTK6uwWJAVT+3rF6Jo6RTojiJ27FQo8Rf60AL+VZbzoVPnMFhKsUnbjR8A3BTCYQ7Mv3hnl8T0A+CX9g== dependencies: "@types/yargs-parser" "*" @@ -4451,9 +4444,9 @@ camelize@^1.0.0: integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ== caniuse-lite@^1.0.30001400: - version "1.0.30001436" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001436.tgz#22d7cbdbbbb60cdc4ca1030ccd6dea9f5de4848b" - integrity sha512-ZmWkKsnC2ifEPoWUvSAIGyOYwT+keAaaWPHiQ9DfMqS1t6tfuyFYoWR78TeZtznkEQ64+vGXH9cZrElwR2Mrxg== + version "1.0.30001439" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001439.tgz#ab7371faeb4adff4b74dad1718a6fd122e45d9cb" + integrity sha512-1MgUzEkoMO6gKfXflStpYgZDlFM7M/ck/bgfVCACO5vnAf0fXoNVHdWtqGU+MYca+4bL9Z5bpOVmR33cWW9G2A== ccount@^2.0.0: version "2.0.1" @@ -5400,9 +5393,9 @@ error-stack-parser@^2.0.6: stackframe "^1.3.4" es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.20.4: - version "1.20.4" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.4.tgz#1d103f9f8d78d4cf0713edcd6d0ed1a46eed5861" - integrity sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA== + version "1.20.5" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.5.tgz#e6dc99177be37cacda5988e692c3fa8b218e95d2" + integrity sha512-7h8MM2EQhsCA7pU/Nv78qOXFpD8Rhqd12gYiSJVkrH9+e8VuA8JlPJK/hQjjlLv6pJvx/z1iRFKzYb0XT/RuAQ== dependencies: call-bind "^1.0.2" es-to-primitive "^1.2.1" @@ -5410,6 +5403,7 @@ es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.20.4: function.prototype.name "^1.1.5" get-intrinsic "^1.1.3" get-symbol-description "^1.0.0" + gopd "^1.0.1" has "^1.0.3" has-property-descriptors "^1.0.0" has-symbols "^1.0.3" @@ -5425,8 +5419,8 @@ es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.20.4: object.assign "^4.1.4" regexp.prototype.flags "^1.4.3" safe-regex-test "^1.0.0" - string.prototype.trimend "^1.0.5" - string.prototype.trimstart "^1.0.5" + string.prototype.trimend "^1.0.6" + string.prototype.trimstart "^1.0.6" unbox-primitive "^1.0.2" es-array-method-boxes-properly@^1.0.0: @@ -6295,9 +6289,9 @@ globals@^11.1.0, globals@^11.12.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.15.0: - version "13.18.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.18.0.tgz#fb224daeeb2bb7d254cd2c640f003528b8d0c1dc" - integrity sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A== + version "13.19.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.19.0.tgz#7a42de8e6ad4f7242fbcca27ea5b23aca367b5c8" + integrity sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ== dependencies: type-fest "^0.20.2" @@ -6339,6 +6333,13 @@ globrex@^0.1.2: resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + gotrue-js@0.9.29: version "0.9.29" resolved "https://registry.yarnpkg.com/gotrue-js/-/gotrue-js-0.9.29.tgz#08e62184d4eaadcd87f95cb6e49e3c4a9742a052" @@ -7484,9 +7485,9 @@ jest@29.3.1: jest-cli "^29.3.1" jotai@^1.7.2: - version "1.11.0" - resolved "https://registry.yarnpkg.com/jotai/-/jotai-1.11.0.tgz#d2a666f16935797743eb41a3b75583ea4e17fefb" - integrity sha512-8OzJmRxcTZoAOJSz6uTnmofmjAOgNOdAOy26rvyw3OBxt6XIoklNnfUTCm8wgp84SSLJbPZA01VS5O/SUz+QYg== + version "1.11.2" + resolved "https://registry.yarnpkg.com/jotai/-/jotai-1.11.2.tgz#274a8eeb3e213f59d2b1e34d1e6583ac65d41dd5" + integrity sha512-hVLn1aS1QprDy+NrvyWIOcaA/LEG5AY0Z7kWtx26EJ8eH8DY8pW1wUM0PrlqQzthqd6HdEVtXLY1rB//0n8LvA== jquery@^3.6.0: version "3.6.1" @@ -9250,7 +9251,7 @@ postcss-value-parser@^4.0.2, postcss-value-parser@^4.1.0, postcss-value-parser@^ resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@8.4.20: +postcss@8.4.20, postcss@^8.4.18: version "8.4.20" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.20.tgz#64c52f509644cecad8567e949f4081d98349dc56" integrity sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g== @@ -9259,15 +9260,6 @@ postcss@8.4.20: picocolors "^1.0.0" source-map-js "^1.0.2" -postcss@^8.4.18: - version "8.4.19" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.19.tgz#61178e2add236b17351897c8bcc0b4c8ecab56fc" - integrity sha512-h+pbPsyhlYj6N2ozBmHhHrs9DzGmbaarbLvWipMRO7RLS+v4onj26MPFXA5OBYFxyqYhUJK456SwDcY9H2/zsA== - dependencies: - nanoid "^3.3.4" - picocolors "^1.0.0" - source-map-js "^1.0.2" - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -10619,7 +10611,7 @@ string.prototype.trim@^1.2.4: define-properties "^1.1.4" es-abstract "^1.20.4" -string.prototype.trimend@^1.0.5: +string.prototype.trimend@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz#c4a27fa026d979d79c04f17397f250a462944533" integrity sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ== @@ -10628,7 +10620,7 @@ string.prototype.trimend@^1.0.5: define-properties "^1.1.4" es-abstract "^1.20.4" -string.prototype.trimstart@^1.0.5: +string.prototype.trimstart@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz#e90ab66aa8e4007d92ef591bbf3cd422c56bdcf4" integrity sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==