From c2d092ae816a19b678f54bf398dc773f4fc91fdf Mon Sep 17 00:00:00 2001 From: inokawa <48897392+inokawa@users.noreply.github.com> Date: Thu, 7 Dec 2023 18:49:42 +0900 Subject: [PATCH] Support mdast v5 and unified 11 --- README.md | 71 +- fixtures/node-footnotes.md | 2 +- package.json | 23 +- renovate.json | 4 - src/__snapshots__/index.spec.ts.snap | 6825 +--------------------- src/index.spec.ts | 141 +- src/index.ts | 2 - src/models/mdast.ts | 6 +- src/models/slate.ts | 4 + src/plugins/remark-to-slate.ts | 16 +- src/plugins/remark-to-slate0.47.ts | 10 - src/plugins/slate-to-remark.ts | 13 +- src/plugins/slate0.47-to-remark.ts | 16 - src/transformers/mdast-to-slate/index.ts | 110 +- src/transformers/slate-to-mdast/index.ts | 33 +- src/transformers/slate-to-slate0.47.ts | 103 - src/transformers/slate0.47-to-slate.ts | 56 - stories/components/slate-editor.tsx | 2 - stories/components/slate0.47-editor.tsx | 219 - stories/playground/current.stories.tsx | 11 +- stories/playground/legacy.stories.tsx | 126 - 21 files changed, 202 insertions(+), 7591 deletions(-) delete mode 100644 src/plugins/remark-to-slate0.47.ts delete mode 100644 src/plugins/slate0.47-to-remark.ts delete mode 100644 src/transformers/slate-to-slate0.47.ts delete mode 100644 src/transformers/slate0.47-to-slate.ts delete mode 100644 stories/components/slate0.47-editor.tsx delete mode 100644 stories/playground/legacy.stories.tsx diff --git a/README.md b/README.md index 9b861ef2..59434e65 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,11 @@ This plugin supports slate 0.50+. The data structure is described [here](https://docs.slatejs.org/concepts/02-nodes). -And also support ~0.47.9 currently, but I don't know in the future. +slate ~0.47.9 was supported until 0.8.1. All nodes in [mdast](https://github.com/syntax-tree/mdast) syntax tree are supported, including nodes created with... - [remark-gfm](https://github.com/remarkjs/remark-gfm) -- [remark-footnotes](https://github.com/remarkjs/remark-footnotes) - [remark-frontmatter](https://github.com/remarkjs/remark-frontmatter) - `math` and `inlineMath` from [remark-math](https://github.com/remarkjs/remark-math). @@ -33,18 +32,17 @@ npm install remark-slate-transformer ### Supported unified versions -| remark-slate-transformer | unified | -| ------------------------ | -------- | -| >=0.7.0 | >=10.1.0 | -| >=0.5.0 <0.7.0 | >=10.0.0 | -| <0.5.0 | <10.0.0 | +| remark-slate-transformer | unified | +| ------------------------ | ---------------- | +| >=0.9.0 | >=11.0.0 | +| >=0.7.0 <0.9.0 | >=10.1.0 <11.0.0 | +| >=0.5.0 <0.7.0 | >=10.0.0 | +| <0.5.0 | <10.0.0 | ## Usage ### Transform remark to slate -#### 0.50+ - ```javascript import { unified } from "unified"; import markdown from "remark-parse"; @@ -58,58 +56,18 @@ const value = processor.processSync(text).result; console.log(value); ``` -#### ~0.47.9 - -```javascript -import { Value } from "slate"; -import { unified } from "unified"; -import markdown from "remark-parse"; -import { remarkToSlateLegacy } from "remark-slate-transformer"; - -const processor = unified().use(markdown).use(remarkToSlateLegacy); - -const text = "# hello world"; - -const value = Value.fromJSON(processor.processSync(text).result); -console.log(value); -``` - ### Transform slate to remark -#### 0.50+ - ```javascript import { unified } from "unified"; import stringify from "remark-stringify"; import { slateToRemark } from "remark-slate-transformer"; -const processor = unified().use(slateToRemark).use(stringify); - -const value = ...; // value passed to slate editor - -const ast = processor.runSync({ - type: "root", - children: value, -}); -const text = processor.stringify(ast); -console.log(text); -``` - -#### ~0.47.9 - -```javascript -import { unified } from "unified"; -import stringify from "remark-stringify"; -import { slateToRemarkLegacy } from "remark-slate-transformer"; - -const processor = unified().use(slateToRemarkLegacy).use(stringify); +const processor = unified().use(stringify); const value = ...; // value passed to slate editor -const ast = processor.runSync({ - type: "root", - children: value.toJSON().document.nodes, -}); +const ast = processor.runSync(slateToRemark(value)); const text = processor.stringify(ast); console.log(text); ``` @@ -142,8 +100,9 @@ const r2s = unified() const value = r2s.processSync(text).result; console.log(value); -const s2r = unified() - .use(slateToRemark, { +const s2r = unified().use(stringify); +const ast = s2r.runSync( + slateToRemark(value, { overrides: { head: (node, next) => ({ type: "heading", @@ -153,11 +112,7 @@ const s2r = unified() foo: (node, next) => ({ type: "foo", bar: node.value }), }, }) - .use(stringify); -const ast = s2r.runSync({ - type: "root", - children: value, -}); +); const text = s2r.stringify(ast); console.log(text); ``` diff --git a/fixtures/node-footnotes.md b/fixtures/node-footnotes.md index 8e5f10fd..7c7c7c9f 100644 --- a/fixtures/node-footnotes.md +++ b/fixtures/node-footnotes.md @@ -1,3 +1,3 @@ -This is footnote[^1]. And this is also ^[inline footnote]. +This is footnote[^1]. [^1]: Here is the footnote. diff --git a/package.json b/package.json index 0195cf0d..55eccd71 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "prepublishOnly": "rimraf lib && npm run build" }, "dependencies": { - "@types/mdast": "^3.0.10", + "@types/mdast": "^4.0.3", "mdast-util-math": "^3.0.0", "tslib": "^2.6.2" }, @@ -42,9 +42,7 @@ "@storybook/react-vite": "7.6.2", "@storybook/source-loader": "7.6.2", "@storybook/test-runner": "0.16.0", - "@types/slate_legacy": "npm:@types/slate@0.47.7", - "@types/slate-react_legacy": "npm:@types/slate-react@0.22.9", - "@types/unist": "2.0.10", + "@types/unist": "3.0.2", "babel-jest": "29.7.0", "concurrently": "7.6.0", "github-markdown-css": "4.0.0", @@ -53,26 +51,23 @@ "react-dom": "18.2.0", "react-is": "18.2.0", "react-syntax-highlighter": "15.5.0", - "remark-footnotes": "4.0.1", - "remark-frontmatter": "4.0.1", - "remark-gfm": "3.0.1", - "remark-math": "5.1.1", - "remark-parse": "10.0.2", - "remark-stringify": "10.0.3", + "remark-frontmatter": "5.0.0", + "remark-gfm": "4.0.0", + "remark-math": "6.0.0", + "remark-parse": "11.0.0", + "remark-stringify": "11.0.0", "rimraf": "5.0.5", "rollup": "4.6.1", "slate": "0.93.0", - "slate_legacy": "npm:slate@0.47.9", "slate-history": "0.93.0", "slate-react": "0.93.0", - "slate-react_legacy": "npm:slate-react@0.22.10", "storybook": "^7.6.0", "typescript": "5.3.3", - "unified": "10.1.2", + "unified": "11.0.4", "vite": "5.0.6" }, "peerDependencies": { - "unified": ">=10.1.0" + "unified": ">=11.0.0" }, "repository": { "type": "git", diff --git a/renovate.json b/renovate.json index 641a3fcd..b8cf40c1 100644 --- a/renovate.json +++ b/renovate.json @@ -12,10 +12,6 @@ { "matchPackageNames": ["slate", "slate-react", "slate-history"], "automerge": false - }, - { - "packagePatterns": ["slate_legacy", "slate-react_legacy"], - "enabled": false } ] } diff --git a/src/__snapshots__/index.spec.ts.snap b/src/__snapshots__/index.spec.ts.snap index e5c97c0b..80eb7f63 100644 --- a/src/__snapshots__/index.spec.ts.snap +++ b/src/__snapshots__/index.spec.ts.snap @@ -1553,26 +1553,26 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaa**bold**_emphasis_~~delete~~\`inline code\` -- list +- list - - list - - list - - list - - list + - list + - list + - list + - list -- [ ] not checked +- [ ] not checked -- [x] checked +- [x] checked -1. ordered list -2. ordered list -3. ordered list - 1. aaa - 2. aaa - 1. eeeee - 2. eeeee - 3. aaa -4. ordered list +1. ordered list +2. ordered list +3. ordered list + 1. aaa + 2. aaa + 1. eeeee + 2. eeeee + 3. aaa +4. ordered list This is [link to GitHub.com](https://github.com/). @@ -1630,6757 +1630,6 @@ export $initHighlight; " `; -exports[`e2e legacy article.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "title: "This is frontmatter" -date: 2020-04-30 12:34 -categories: [JavaScript, React]", - }, - ], - "object": "block", - "type": "yaml", - }, - { - "data": { - "depth": 1, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "heading 1", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "depth": 2, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "heading 2", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "depth": 3, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "heading 3", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "depth": 4, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "heading 4", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "depth": 5, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "heading 5", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "depth": 6, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "heading 6", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aaaaaaaa", - }, - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "bold", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - ], - "object": "text", - "text": "emphasis", - }, - { - "marks": [ - { - "object": "mark", - "type": "delete", - }, - ], - "object": "text", - "text": "delete", - }, - { - "marks": [ - { - "object": "mark", - "type": "inlineCode", - }, - ], - "object": "text", - "text": "inline code", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "ordered": false, - "spread": true, - "start": null, - }, - "nodes": [ - { - "data": { - "checked": null, - "spread": true, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "list", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "ordered": false, - "spread": false, - "start": null, - }, - "nodes": [ - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "list", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "ordered": false, - "spread": false, - "start": null, - }, - "nodes": [ - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "list", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - ], - "object": "block", - "type": "list", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "list", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "list", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - ], - "object": "block", - "type": "list", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": false, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "not checked", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": true, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "checked", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - ], - "object": "block", - "type": "list", - }, - { - "data": { - "ordered": true, - "spread": false, - "start": 1, - }, - "nodes": [ - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "ordered list", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "ordered list", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "ordered list", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "ordered": true, - "spread": false, - "start": 1, - }, - "nodes": [ - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aaa", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aaa", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "ordered": true, - "spread": false, - "start": 1, - }, - "nodes": [ - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "eeeee", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "eeeee", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - ], - "object": "block", - "type": "list", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aaa", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - ], - "object": "block", - "type": "list", - }, - ], - "object": "block", - "type": "listItem", - }, - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "ordered list", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - ], - "object": "block", - "type": "list", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "This is ", - }, - { - "data": { - "title": null, - "url": "https://github.com/", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "link to GitHub.com", - }, - ], - "object": "inline", - "type": "link", - }, - { - "marks": [], - "object": "text", - "text": ".", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "This is ", - }, - { - "data": { - "alt": "image", - "title": null, - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "inline", - "type": "image", - }, - { - "marks": [], - "object": "text", - "text": ".", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "quote -quote -quote -quote", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "blockquote", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "quote", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "quoted quote", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "blockquote", - }, - ], - "object": "block", - "type": "blockquote", - }, - { - "data": { - "align": [ - "left", - "right", - "center", - ], - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Left align", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Right align", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Center align", - }, - ], - "object": "block", - "type": "tableCell", - }, - ], - "object": "block", - "type": "tableRow", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "This", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "This", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "This", - }, - ], - "object": "block", - "type": "tableCell", - }, - ], - "object": "block", - "type": "tableRow", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "column", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "column", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "column", - }, - ], - "object": "block", - "type": "tableCell", - }, - ], - "object": "block", - "type": "tableRow", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "will", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "will", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "will", - }, - ], - "object": "block", - "type": "tableCell", - }, - ], - "object": "block", - "type": "tableRow", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "be", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "be", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "be", - }, - ], - "object": "block", - "type": "tableCell", - }, - ], - "object": "block", - "type": "tableRow", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "left", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "right", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "center", - }, - ], - "object": "block", - "type": "tableCell", - }, - ], - "object": "block", - "type": "tableRow", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aligned", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aligned", - }, - ], - "object": "block", - "type": "tableCell", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aligned", - }, - ], - "object": "block", - "type": "tableCell", - }, - ], - "object": "block", - "type": "tableRow", - }, - ], - "object": "block", - "type": "table", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "
-This is HTML -
", - }, - ], - "object": "block", - "type": "html", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "block", - "type": "thematicBreak", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "block", - "type": "thematicBreak", - }, - { - "data": { - "lang": "javascript", - "meta": null, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "function $initHighlight(block, cls) { - try { - if (cls.search(/\\bno\\-highlight\\b/) != -1) - return process(block, true, 0x0F) + - \` class="\${cls}"\`; - } catch (e) { - /* handle exception */ - } - for (var i = 0 / 2; i < classes.length; i++) { - if (checkCondition(classes[i]) === undefined) - console.log('undefined'); - } - - return ( -
- {block} -
- ) -} - -export $initHighlight;", - }, - ], - "object": "block", - "type": "code", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy article.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "0", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "1", - "nodes": Immutable.List [ - Immutable.Record { - "key": "2", - "marks": Immutable.Set [], - "text": "title: "This is frontmatter" -date: 2020-04-30 12:34 -categories: [JavaScript, React]", - }, - ], - "type": "yaml", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 1, - }, - "key": "3", - "nodes": Immutable.List [ - Immutable.Record { - "key": "4", - "marks": Immutable.Set [], - "text": "heading 1", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 2, - }, - "key": "5", - "nodes": Immutable.List [ - Immutable.Record { - "key": "6", - "marks": Immutable.Set [], - "text": "heading 2", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 3, - }, - "key": "7", - "nodes": Immutable.List [ - Immutable.Record { - "key": "8", - "marks": Immutable.Set [], - "text": "heading 3", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 4, - }, - "key": "9", - "nodes": Immutable.List [ - Immutable.Record { - "key": "10", - "marks": Immutable.Set [], - "text": "heading 4", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 5, - }, - "key": "11", - "nodes": Immutable.List [ - Immutable.Record { - "key": "12", - "marks": Immutable.Set [], - "text": "heading 5", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 6, - }, - "key": "13", - "nodes": Immutable.List [ - Immutable.Record { - "key": "14", - "marks": Immutable.Set [], - "text": "heading 6", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "15", - "nodes": Immutable.List [ - Immutable.Record { - "key": "16", - "marks": Immutable.Set [], - "text": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "17", - "nodes": Immutable.List [ - Immutable.Record { - "key": "18", - "marks": Immutable.Set [], - "text": "aaaaaaaa", - }, - Immutable.Record { - "key": "19", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "bold", - }, - Immutable.Record { - "key": "20", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - ], - "text": "emphasis", - }, - Immutable.Record { - "key": "21", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "delete", - }, - ], - "text": "delete", - }, - Immutable.Record { - "key": "22", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "inlineCode", - }, - ], - "text": "inline code", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "ordered": false, - "start": null, - "spread": true, - }, - "key": "23", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": true, - }, - "key": "24", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "25", - "nodes": Immutable.List [ - Immutable.Record { - "key": "26", - "marks": Immutable.Set [], - "text": "list", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "ordered": false, - "start": null, - "spread": false, - }, - "key": "27", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "28", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "29", - "nodes": Immutable.List [ - Immutable.Record { - "key": "30", - "marks": Immutable.Set [], - "text": "list", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "ordered": false, - "start": null, - "spread": false, - }, - "key": "31", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "32", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "33", - "nodes": Immutable.List [ - Immutable.Record { - "key": "34", - "marks": Immutable.Set [], - "text": "list", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - ], - "type": "list", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "35", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "36", - "nodes": Immutable.List [ - Immutable.Record { - "key": "37", - "marks": Immutable.Set [], - "text": "list", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "38", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "39", - "nodes": Immutable.List [ - Immutable.Record { - "key": "40", - "marks": Immutable.Set [], - "text": "list", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - ], - "type": "list", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": false, - "spread": false, - }, - "key": "41", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "42", - "nodes": Immutable.List [ - Immutable.Record { - "key": "43", - "marks": Immutable.Set [], - "text": "not checked", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": true, - "spread": false, - }, - "key": "44", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "45", - "nodes": Immutable.List [ - Immutable.Record { - "key": "46", - "marks": Immutable.Set [], - "text": "checked", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - ], - "type": "list", - }, - Immutable.Record { - "data": Immutable.Map { - "ordered": true, - "start": 1, - "spread": false, - }, - "key": "47", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "48", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "49", - "nodes": Immutable.List [ - Immutable.Record { - "key": "50", - "marks": Immutable.Set [], - "text": "ordered list", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "51", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "52", - "nodes": Immutable.List [ - Immutable.Record { - "key": "53", - "marks": Immutable.Set [], - "text": "ordered list", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "54", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "55", - "nodes": Immutable.List [ - Immutable.Record { - "key": "56", - "marks": Immutable.Set [], - "text": "ordered list", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "ordered": true, - "start": 1, - "spread": false, - }, - "key": "57", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "58", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "59", - "nodes": Immutable.List [ - Immutable.Record { - "key": "60", - "marks": Immutable.Set [], - "text": "aaa", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "61", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "62", - "nodes": Immutable.List [ - Immutable.Record { - "key": "63", - "marks": Immutable.Set [], - "text": "aaa", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "ordered": true, - "start": 1, - "spread": false, - }, - "key": "64", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "65", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "66", - "nodes": Immutable.List [ - Immutable.Record { - "key": "67", - "marks": Immutable.Set [], - "text": "eeeee", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "68", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "69", - "nodes": Immutable.List [ - Immutable.Record { - "key": "70", - "marks": Immutable.Set [], - "text": "eeeee", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - ], - "type": "list", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "71", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "72", - "nodes": Immutable.List [ - Immutable.Record { - "key": "73", - "marks": Immutable.Set [], - "text": "aaa", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - ], - "type": "list", - }, - ], - "type": "listItem", - }, - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "74", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "75", - "nodes": Immutable.List [ - Immutable.Record { - "key": "76", - "marks": Immutable.Set [], - "text": "ordered list", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - ], - "type": "list", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "77", - "nodes": Immutable.List [ - Immutable.Record { - "key": "78", - "marks": Immutable.Set [], - "text": "This is ", - }, - Immutable.Record { - "data": Immutable.Map { - "url": "https://github.com/", - "title": null, - }, - "key": "79", - "nodes": Immutable.List [ - Immutable.Record { - "key": "80", - "marks": Immutable.Set [], - "text": "link to GitHub.com", - }, - ], - "type": "link", - }, - Immutable.Record { - "key": "81", - "marks": Immutable.Set [], - "text": ".", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "82", - "nodes": Immutable.List [ - Immutable.Record { - "key": "83", - "marks": Immutable.Set [], - "text": "This is ", - }, - Immutable.Record { - "data": Immutable.Map { - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - "title": null, - "alt": "image", - }, - "key": "84", - "nodes": Immutable.List [ - Immutable.Record { - "key": "85", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "image", - }, - Immutable.Record { - "key": "86", - "marks": Immutable.Set [], - "text": ".", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "87", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "88", - "nodes": Immutable.List [ - Immutable.Record { - "key": "89", - "marks": Immutable.Set [], - "text": "quote -quote -quote -quote", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockquote", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "90", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "91", - "nodes": Immutable.List [ - Immutable.Record { - "key": "92", - "marks": Immutable.Set [], - "text": "quote", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "93", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "94", - "nodes": Immutable.List [ - Immutable.Record { - "key": "95", - "marks": Immutable.Set [], - "text": "quoted quote", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockquote", - }, - ], - "type": "blockquote", - }, - Immutable.Record { - "data": Immutable.Map { - "align": [ - "left", - "right", - "center", - ], - }, - "key": "96", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "97", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "98", - "nodes": Immutable.List [ - Immutable.Record { - "key": "99", - "marks": Immutable.Set [], - "text": "Left align", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "100", - "nodes": Immutable.List [ - Immutable.Record { - "key": "101", - "marks": Immutable.Set [], - "text": "Right align", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "102", - "nodes": Immutable.List [ - Immutable.Record { - "key": "103", - "marks": Immutable.Set [], - "text": "Center align", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "104", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "105", - "nodes": Immutable.List [ - Immutable.Record { - "key": "106", - "marks": Immutable.Set [], - "text": "This", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "107", - "nodes": Immutable.List [ - Immutable.Record { - "key": "108", - "marks": Immutable.Set [], - "text": "This", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "109", - "nodes": Immutable.List [ - Immutable.Record { - "key": "110", - "marks": Immutable.Set [], - "text": "This", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "111", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "112", - "nodes": Immutable.List [ - Immutable.Record { - "key": "113", - "marks": Immutable.Set [], - "text": "column", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "114", - "nodes": Immutable.List [ - Immutable.Record { - "key": "115", - "marks": Immutable.Set [], - "text": "column", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "116", - "nodes": Immutable.List [ - Immutable.Record { - "key": "117", - "marks": Immutable.Set [], - "text": "column", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "118", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "119", - "nodes": Immutable.List [ - Immutable.Record { - "key": "120", - "marks": Immutable.Set [], - "text": "will", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "121", - "nodes": Immutable.List [ - Immutable.Record { - "key": "122", - "marks": Immutable.Set [], - "text": "will", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "123", - "nodes": Immutable.List [ - Immutable.Record { - "key": "124", - "marks": Immutable.Set [], - "text": "will", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "125", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "126", - "nodes": Immutable.List [ - Immutable.Record { - "key": "127", - "marks": Immutable.Set [], - "text": "be", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "128", - "nodes": Immutable.List [ - Immutable.Record { - "key": "129", - "marks": Immutable.Set [], - "text": "be", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "130", - "nodes": Immutable.List [ - Immutable.Record { - "key": "131", - "marks": Immutable.Set [], - "text": "be", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "132", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "133", - "nodes": Immutable.List [ - Immutable.Record { - "key": "134", - "marks": Immutable.Set [], - "text": "left", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "135", - "nodes": Immutable.List [ - Immutable.Record { - "key": "136", - "marks": Immutable.Set [], - "text": "right", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "137", - "nodes": Immutable.List [ - Immutable.Record { - "key": "138", - "marks": Immutable.Set [], - "text": "center", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "139", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "140", - "nodes": Immutable.List [ - Immutable.Record { - "key": "141", - "marks": Immutable.Set [], - "text": "aligned", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "142", - "nodes": Immutable.List [ - Immutable.Record { - "key": "143", - "marks": Immutable.Set [], - "text": "aligned", - }, - ], - "type": "tableCell", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "144", - "nodes": Immutable.List [ - Immutable.Record { - "key": "145", - "marks": Immutable.Set [], - "text": "aligned", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "146", - "nodes": Immutable.List [ - Immutable.Record { - "key": "147", - "marks": Immutable.Set [], - "text": "
-This is HTML -
", - }, - ], - "type": "html", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "148", - "nodes": Immutable.List [ - Immutable.Record { - "key": "149", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "thematicBreak", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "150", - "nodes": Immutable.List [ - Immutable.Record { - "key": "151", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "thematicBreak", - }, - Immutable.Record { - "data": Immutable.Map { - "lang": "javascript", - "meta": null, - }, - "key": "152", - "nodes": Immutable.List [ - Immutable.Record { - "key": "153", - "marks": Immutable.Set [], - "text": "function $initHighlight(block, cls) { - try { - if (cls.search(/\\bno\\-highlight\\b/) != -1) - return process(block, true, 0x0F) + - \` class="\${cls}"\`; - } catch (e) { - /* handle exception */ - } - for (var i = 0 / 2; i < classes.length; i++) { - if (checkCondition(classes[i]) === undefined) - console.log('undefined'); - } - - return ( -
- {block} -
- ) -} - -export $initHighlight;", - }, - ], - "type": "code", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "2", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "2", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy article.md 3`] = ` -{ - "children": [ - { - "type": "yaml", - "value": "title: "This is frontmatter" -date: 2020-04-30 12:34 -categories: [JavaScript, React]", - }, - { - "children": [ - { - "type": "text", - "value": "heading 1", - }, - ], - "depth": 1, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "heading 2", - }, - ], - "depth": 2, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "heading 3", - }, - ], - "depth": 3, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "heading 4", - }, - ], - "depth": 4, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "heading 5", - }, - ], - "depth": 5, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "heading 6", - }, - ], - "depth": 6, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "type": "text", - "value": "aaaaaaaa", - }, - { - "children": [ - { - "type": "text", - "value": "bold", - }, - ], - "type": "strong", - }, - { - "children": [ - { - "type": "text", - "value": "emphasis", - }, - ], - "type": "emphasis", - }, - { - "children": [ - { - "type": "text", - "value": "delete", - }, - ], - "type": "delete", - }, - { - "type": "inlineCode", - "value": "inline code", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "list", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "list", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "list", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - ], - "ordered": false, - "spread": false, - "start": null, - "type": "list", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "list", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "list", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - ], - "ordered": false, - "spread": false, - "start": null, - "type": "list", - }, - ], - "spread": true, - "type": "listItem", - }, - { - "checked": false, - "children": [ - { - "children": [ - { - "type": "text", - "value": "not checked", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": true, - "children": [ - { - "children": [ - { - "type": "text", - "value": "checked", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - ], - "ordered": false, - "spread": true, - "start": null, - "type": "list", - }, - { - "children": [ - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "ordered list", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "ordered list", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "ordered list", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "aaa", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "aaa", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "eeeee", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "eeeee", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - ], - "ordered": true, - "spread": false, - "start": 1, - "type": "list", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "aaa", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - ], - "ordered": true, - "spread": false, - "start": 1, - "type": "list", - }, - ], - "spread": false, - "type": "listItem", - }, - { - "checked": null, - "children": [ - { - "children": [ - { - "type": "text", - "value": "ordered list", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - ], - "ordered": true, - "spread": false, - "start": 1, - "type": "list", - }, - { - "children": [ - { - "type": "text", - "value": "This is ", - }, - { - "children": [ - { - "type": "text", - "value": "link to GitHub.com", - }, - ], - "title": null, - "type": "link", - "url": "https://github.com/", - }, - { - "type": "text", - "value": ".", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "type": "text", - "value": "This is ", - }, - { - "alt": "image", - "title": null, - "type": "image", - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - }, - { - "type": "text", - "value": ".", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "quote -quote -quote -quote", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockquote", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "quote", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "quoted quote", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockquote", - }, - ], - "type": "blockquote", - }, - { - "align": [ - "left", - "right", - "center", - ], - "children": [ - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "Left align", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "Right align", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "Center align", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "This", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "This", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "This", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "column", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "column", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "column", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "will", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "will", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "will", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "be", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "be", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "be", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "left", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "right", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "center", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "aligned", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "aligned", - }, - ], - "type": "tableCell", - }, - { - "children": [ - { - "type": "text", - "value": "aligned", - }, - ], - "type": "tableCell", - }, - ], - "type": "tableRow", - }, - ], - "type": "table", - }, - { - "type": "html", - "value": "
-This is HTML -
", - }, - { - "type": "thematicBreak", - }, - { - "type": "thematicBreak", - }, - { - "lang": "javascript", - "meta": null, - "type": "code", - "value": "function $initHighlight(block, cls) { - try { - if (cls.search(/\\bno\\-highlight\\b/) != -1) - return process(block, true, 0x0F) + - \` class="\${cls}"\`; - } catch (e) { - /* handle exception */ - } - for (var i = 0 / 2; i < classes.length; i++) { - if (checkCondition(classes[i]) === undefined) - console.log('undefined'); - } - - return ( -
- {block} -
- ) -} - -export $initHighlight;", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy article.md 4`] = ` -"--- -title: "This is frontmatter" -date: 2020-04-30 12:34 -categories: [JavaScript, React] ---- - -# heading 1 - -## heading 2 - -### heading 3 - -#### heading 4 - -##### heading 5 - -###### heading 6 - -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - -aaaaaaaa**bold**_emphasis_~~delete~~\`inline code\` - -- list - - - list - - list - - list - - list - -- [ ] not checked - -- [x] checked - -1. ordered list -2. ordered list -3. ordered list - 1. aaa - 2. aaa - 1. eeeee - 2. eeeee - 3. aaa -4. ordered list - -This is [link to GitHub.com](https://github.com/). - -This is ![image](https://github.githubassets.com/images/modules/logos_page/Octocat.png). - -> quote -> quote -> quote -> quote - -> quote -> -> > quoted quote - -| Left align | Right align | Center align | -| :--------- | ----------: | :----------: | -| This | This | This | -| column | column | column | -| will | will | will | -| be | be | be | -| left | right | center | -| aligned | aligned | aligned | - -
-This is HTML -
- -*** - -*** - -\`\`\`javascript -function $initHighlight(block, cls) { - try { - if (cls.search(/\\bno\\-highlight\\b/) != -1) - return process(block, true, 0x0F) + - \` class="\${cls}"\`; - } catch (e) { - /* handle exception */ - } - for (var i = 0 / 2; i < classes.length; i++) { - if (checkCondition(classes[i]) === undefined) - console.log('undefined'); - } - - return ( -
- {block} -
- ) -} - -export $initHighlight; -\`\`\` -" -`; - -exports[`e2e legacy node-break.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "block", - "type": "thematicBreak", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "block", - "type": "thematicBreak", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-break.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "154", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "155", - "nodes": Immutable.List [ - Immutable.Record { - "key": "156", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "thematicBreak", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "157", - "nodes": Immutable.List [ - Immutable.Record { - "key": "158", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "thematicBreak", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "156", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "156", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-break.md 3`] = ` -{ - "children": [ - { - "type": "thematicBreak", - }, - { - "type": "thematicBreak", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-break.md 4`] = ` -"*** - -*** -" -`; - -exports[`e2e legacy node-code.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": { - "lang": "css", - "meta": "metadata="12345"", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "@font-face { - font-family: Chunkfive; - src: url("Chunkfive.otf"); -} - -body, -.usertext { - color: #f0f0f0; - background: #600; - font-family: Chunkfive, sans; - --heading-1: 30px/32px Helvetica, sans-serif; -} - -@import url(print.css); -@media print { - a[href^="http"]::after { - content: attr(href); - } -}", - }, - ], - "object": "block", - "type": "code", - }, - { - "data": { - "lang": "javascript", - "meta": null, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "function $initHighlight(block, cls) { - try { - if (cls.search(/\\bno\\-highlight\\b/) != -1) - return process(block, true, 0x0F) + - \` class="\${cls}"\`; - } catch (e) { - /* handle exception */ - } - for (var i = 0 / 2; i < classes.length; i++) { - if (checkCondition(classes[i]) === undefined) - console.log('undefined'); - } - - return ( -
- {block} -
- ) -} - -export $initHighlight;", - }, - ], - "object": "block", - "type": "code", - }, - { - "data": { - "lang": "typescript", - "meta": null, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "class MyClass { - public static myValue: string; - constructor(init: string) { - this.myValue = init; - } -} -import fs = require("fs"); -module MyModule { - export interface MyInterface extends Other { - myProperty: any; - } -} -declare magicNumber number; -myArray.forEach(() => { }); // fat arrow syntax", - }, - ], - "object": "block", - "type": "code", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-code.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "159", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "lang": "css", - "meta": "metadata="12345"", - }, - "key": "160", - "nodes": Immutable.List [ - Immutable.Record { - "key": "161", - "marks": Immutable.Set [], - "text": "@font-face { - font-family: Chunkfive; - src: url("Chunkfive.otf"); -} - -body, -.usertext { - color: #f0f0f0; - background: #600; - font-family: Chunkfive, sans; - --heading-1: 30px/32px Helvetica, sans-serif; -} - -@import url(print.css); -@media print { - a[href^="http"]::after { - content: attr(href); - } -}", - }, - ], - "type": "code", - }, - Immutable.Record { - "data": Immutable.Map { - "lang": "javascript", - "meta": null, - }, - "key": "162", - "nodes": Immutable.List [ - Immutable.Record { - "key": "163", - "marks": Immutable.Set [], - "text": "function $initHighlight(block, cls) { - try { - if (cls.search(/\\bno\\-highlight\\b/) != -1) - return process(block, true, 0x0F) + - \` class="\${cls}"\`; - } catch (e) { - /* handle exception */ - } - for (var i = 0 / 2; i < classes.length; i++) { - if (checkCondition(classes[i]) === undefined) - console.log('undefined'); - } - - return ( -
- {block} -
- ) -} - -export $initHighlight;", - }, - ], - "type": "code", - }, - Immutable.Record { - "data": Immutable.Map { - "lang": "typescript", - "meta": null, - }, - "key": "164", - "nodes": Immutable.List [ - Immutable.Record { - "key": "165", - "marks": Immutable.Set [], - "text": "class MyClass { - public static myValue: string; - constructor(init: string) { - this.myValue = init; - } -} -import fs = require("fs"); -module MyModule { - export interface MyInterface extends Other { - myProperty: any; - } -} -declare magicNumber number; -myArray.forEach(() => { }); // fat arrow syntax", - }, - ], - "type": "code", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "161", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "161", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-code.md 3`] = ` -{ - "children": [ - { - "lang": "css", - "meta": "metadata="12345"", - "type": "code", - "value": "@font-face { - font-family: Chunkfive; - src: url("Chunkfive.otf"); -} - -body, -.usertext { - color: #f0f0f0; - background: #600; - font-family: Chunkfive, sans; - --heading-1: 30px/32px Helvetica, sans-serif; -} - -@import url(print.css); -@media print { - a[href^="http"]::after { - content: attr(href); - } -}", - }, - { - "lang": "javascript", - "meta": null, - "type": "code", - "value": "function $initHighlight(block, cls) { - try { - if (cls.search(/\\bno\\-highlight\\b/) != -1) - return process(block, true, 0x0F) + - \` class="\${cls}"\`; - } catch (e) { - /* handle exception */ - } - for (var i = 0 / 2; i < classes.length; i++) { - if (checkCondition(classes[i]) === undefined) - console.log('undefined'); - } - - return ( -
- {block} -
- ) -} - -export $initHighlight;", - }, - { - "lang": "typescript", - "meta": null, - "type": "code", - "value": "class MyClass { - public static myValue: string; - constructor(init: string) { - this.myValue = init; - } -} -import fs = require("fs"); -module MyModule { - export interface MyInterface extends Other { - myProperty: any; - } -} -declare magicNumber number; -myArray.forEach(() => { }); // fat arrow syntax", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-code.md 4`] = ` -"\`\`\`css metadata="12345" -@font-face { - font-family: Chunkfive; - src: url("Chunkfive.otf"); -} - -body, -.usertext { - color: #f0f0f0; - background: #600; - font-family: Chunkfive, sans; - --heading-1: 30px/32px Helvetica, sans-serif; -} - -@import url(print.css); -@media print { - a[href^="http"]::after { - content: attr(href); - } -} -\`\`\` - -\`\`\`javascript -function $initHighlight(block, cls) { - try { - if (cls.search(/\\bno\\-highlight\\b/) != -1) - return process(block, true, 0x0F) + - \` class="\${cls}"\`; - } catch (e) { - /* handle exception */ - } - for (var i = 0 / 2; i < classes.length; i++) { - if (checkCondition(classes[i]) === undefined) - console.log('undefined'); - } - - return ( -
- {block} -
- ) -} - -export $initHighlight; -\`\`\` - -\`\`\`typescript -class MyClass { - public static myValue: string; - constructor(init: string) { - this.myValue = init; - } -} -import fs = require("fs"); -module MyModule { - export interface MyInterface extends Other { - myProperty: any; - } -} -declare magicNumber number; -myArray.forEach(() => { }); // fat arrow syntax -\`\`\` -" -`; - -exports[`e2e legacy node-footnotes.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "This is footnote", - }, - { - "data": { - "identifier": "1", - "label": "1", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "inline", - "type": "footnoteReference", - }, - { - "marks": [], - "object": "text", - "text": ". And this is also ", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "inline footnote", - }, - ], - "object": "inline", - "type": "footnote", - }, - { - "marks": [], - "object": "text", - "text": ".", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "identifier": "1", - "label": "1", - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Here is the footnote.", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "inline", - "type": "footnoteDefinition", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-footnotes.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "166", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "167", - "nodes": Immutable.List [ - Immutable.Record { - "key": "168", - "marks": Immutable.Set [], - "text": "This is footnote", - }, - Immutable.Record { - "data": Immutable.Map { - "identifier": "1", - "label": "1", - }, - "key": "169", - "nodes": Immutable.List [ - Immutable.Record { - "key": "170", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "footnoteReference", - }, - Immutable.Record { - "key": "171", - "marks": Immutable.Set [], - "text": ". And this is also ", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "172", - "nodes": Immutable.List [ - Immutable.Record { - "key": "173", - "marks": Immutable.Set [], - "text": "inline footnote", - }, - ], - "type": "footnote", - }, - Immutable.Record { - "key": "174", - "marks": Immutable.Set [], - "text": ".", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "identifier": "1", - "label": "1", - }, - "key": "175", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "176", - "nodes": Immutable.List [ - Immutable.Record { - "key": "177", - "marks": Immutable.Set [], - "text": "Here is the footnote.", - }, - ], - "type": "paragraph", - }, - ], - "type": "footnoteDefinition", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "168", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "168", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-footnotes.md 3`] = ` -{ - "children": [ - { - "children": [ - { - "type": "text", - "value": "This is footnote", - }, - { - "identifier": "1", - "label": "1", - "type": "footnoteReference", - }, - { - "type": "text", - "value": ". And this is also ", - }, - { - "children": [ - { - "type": "text", - "value": "inline footnote", - }, - ], - "type": "footnote", - }, - { - "type": "text", - "value": ".", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "Here is the footnote.", - }, - ], - "type": "paragraph", - }, - ], - "identifier": "1", - "label": "1", - "type": "footnoteDefinition", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-footnotes.md 4`] = ` -"This is footnote[^1]. And this is also ^[inline footnote]. - -[^1]: Here is the footnote. -" -`; - -exports[`e2e legacy node-frontmatter-toml.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "title = "This is toml" -date = "2020-04-30 22:34"", - }, - ], - "object": "block", - "type": "toml", - }, - { - "data": { - "depth": 1, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Other markdown", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "blablabla", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-frontmatter-toml.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "178", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "179", - "nodes": Immutable.List [ - Immutable.Record { - "key": "180", - "marks": Immutable.Set [], - "text": "title = "This is toml" -date = "2020-04-30 22:34"", - }, - ], - "type": "toml", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 1, - }, - "key": "181", - "nodes": Immutable.List [ - Immutable.Record { - "key": "182", - "marks": Immutable.Set [], - "text": "Other markdown", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "183", - "nodes": Immutable.List [ - Immutable.Record { - "key": "184", - "marks": Immutable.Set [], - "text": "blablabla", - }, - ], - "type": "paragraph", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "180", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "180", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-frontmatter-toml.md 3`] = ` -{ - "children": [ - { - "type": "toml", - "value": "title = "This is toml" -date = "2020-04-30 22:34"", - }, - { - "children": [ - { - "type": "text", - "value": "Other markdown", - }, - ], - "depth": 1, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "blablabla", - }, - ], - "type": "paragraph", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-frontmatter-toml.md 4`] = ` -"+++ -title = "This is toml" -date = "2020-04-30 22:34" -+++ - -# Other markdown - -blablabla -" -`; - -exports[`e2e legacy node-frontmatter-yaml.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "title: "This is yaml" -date: 2020-04-30 22:34 -categories: [JavaScript, React]", - }, - ], - "object": "block", - "type": "yaml", - }, - { - "data": { - "depth": 1, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Other markdown", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "blablabla", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-frontmatter-yaml.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "185", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "186", - "nodes": Immutable.List [ - Immutable.Record { - "key": "187", - "marks": Immutable.Set [], - "text": "title: "This is yaml" -date: 2020-04-30 22:34 -categories: [JavaScript, React]", - }, - ], - "type": "yaml", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 1, - }, - "key": "188", - "nodes": Immutable.List [ - Immutable.Record { - "key": "189", - "marks": Immutable.Set [], - "text": "Other markdown", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "190", - "nodes": Immutable.List [ - Immutable.Record { - "key": "191", - "marks": Immutable.Set [], - "text": "blablabla", - }, - ], - "type": "paragraph", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "187", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "187", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-frontmatter-yaml.md 3`] = ` -{ - "children": [ - { - "type": "yaml", - "value": "title: "This is yaml" -date: 2020-04-30 22:34 -categories: [JavaScript, React]", - }, - { - "children": [ - { - "type": "text", - "value": "Other markdown", - }, - ], - "depth": 1, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "blablabla", - }, - ], - "type": "paragraph", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-frontmatter-yaml.md 4`] = ` -"--- -title: "This is yaml" -date: 2020-04-30 22:34 -categories: [JavaScript, React] ---- - -# Other markdown - -blablabla -" -`; - -exports[`e2e legacy node-heading.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": { - "depth": 1, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Alpha", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aaaa", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "depth": 2, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Bravo", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "bbbb", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "depth": 3, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Charlie", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "cccc", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "depth": 2, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Delta", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "dddd", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "depth": 3, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "E", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "depth": 4, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "F", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "depth": 5, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "G", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "depth": 6, - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "H", - }, - ], - "object": "block", - "type": "heading", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-heading.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "192", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "depth": 1, - }, - "key": "193", - "nodes": Immutable.List [ - Immutable.Record { - "key": "194", - "marks": Immutable.Set [], - "text": "Alpha", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "195", - "nodes": Immutable.List [ - Immutable.Record { - "key": "196", - "marks": Immutable.Set [], - "text": "aaaa", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 2, - }, - "key": "197", - "nodes": Immutable.List [ - Immutable.Record { - "key": "198", - "marks": Immutable.Set [], - "text": "Bravo", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "199", - "nodes": Immutable.List [ - Immutable.Record { - "key": "200", - "marks": Immutable.Set [], - "text": "bbbb", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 3, - }, - "key": "201", - "nodes": Immutable.List [ - Immutable.Record { - "key": "202", - "marks": Immutable.Set [], - "text": "Charlie", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "203", - "nodes": Immutable.List [ - Immutable.Record { - "key": "204", - "marks": Immutable.Set [], - "text": "cccc", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 2, - }, - "key": "205", - "nodes": Immutable.List [ - Immutable.Record { - "key": "206", - "marks": Immutable.Set [], - "text": "Delta", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "207", - "nodes": Immutable.List [ - Immutable.Record { - "key": "208", - "marks": Immutable.Set [], - "text": "dddd", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 3, - }, - "key": "209", - "nodes": Immutable.List [ - Immutable.Record { - "key": "210", - "marks": Immutable.Set [], - "text": "E", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 4, - }, - "key": "211", - "nodes": Immutable.List [ - Immutable.Record { - "key": "212", - "marks": Immutable.Set [], - "text": "F", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 5, - }, - "key": "213", - "nodes": Immutable.List [ - Immutable.Record { - "key": "214", - "marks": Immutable.Set [], - "text": "G", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 6, - }, - "key": "215", - "nodes": Immutable.List [ - Immutable.Record { - "key": "216", - "marks": Immutable.Set [], - "text": "H", - }, - ], - "type": "heading", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "194", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "194", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-heading.md 3`] = ` -{ - "children": [ - { - "children": [ - { - "type": "text", - "value": "Alpha", - }, - ], - "depth": 1, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "aaaa", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "type": "text", - "value": "Bravo", - }, - ], - "depth": 2, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "bbbb", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "type": "text", - "value": "Charlie", - }, - ], - "depth": 3, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "cccc", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "type": "text", - "value": "Delta", - }, - ], - "depth": 2, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "dddd", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "type": "text", - "value": "E", - }, - ], - "depth": 3, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "F", - }, - ], - "depth": 4, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "G", - }, - ], - "depth": 5, - "type": "heading", - }, - { - "children": [ - { - "type": "text", - "value": "H", - }, - ], - "depth": 6, - "type": "heading", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-heading.md 4`] = ` -"# Alpha - -aaaa - -## Bravo - -bbbb - -### Charlie - -cccc - -## Delta - -dddd - -### E - -#### F - -##### G - -###### H -" -`; - -exports[`e2e legacy node-math.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Lift(", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "L", - }, - ], - "object": "inline", - "type": "inlineMath", - }, - { - "marks": [], - "object": "text", - "text": ") can be determined by Lift Coefficient (", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "C_L", - }, - ], - "object": "inline", - "type": "inlineMath", - }, - { - "marks": [], - "object": "text", - "text": ") like the following -equation.", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "L = \\frac{1}{2} \\rho v^2 S C_L", - }, - ], - "object": "block", - "type": "math", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-math.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "217", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "218", - "nodes": Immutable.List [ - Immutable.Record { - "key": "219", - "marks": Immutable.Set [], - "text": "Lift(", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "220", - "nodes": Immutable.List [ - Immutable.Record { - "key": "221", - "marks": Immutable.Set [], - "text": "L", - }, - ], - "type": "inlineMath", - }, - Immutable.Record { - "key": "222", - "marks": Immutable.Set [], - "text": ") can be determined by Lift Coefficient (", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "223", - "nodes": Immutable.List [ - Immutable.Record { - "key": "224", - "marks": Immutable.Set [], - "text": "C_L", - }, - ], - "type": "inlineMath", - }, - Immutable.Record { - "key": "225", - "marks": Immutable.Set [], - "text": ") like the following -equation.", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "226", - "nodes": Immutable.List [ - Immutable.Record { - "key": "227", - "marks": Immutable.Set [], - "text": "L = \\frac{1}{2} \\rho v^2 S C_L", - }, - ], - "type": "math", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "219", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "219", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-math.md 3`] = ` -{ - "children": [ - { - "children": [ - { - "type": "text", - "value": "Lift(", - }, - { - "type": "inlineMath", - "value": "L", - }, - { - "type": "text", - "value": ") can be determined by Lift Coefficient (", - }, - { - "type": "inlineMath", - "value": "C_L", - }, - { - "type": "text", - "value": ") like the following -equation.", - }, - ], - "type": "paragraph", - }, - { - "type": "math", - "value": "L = \\frac{1}{2} \\rho v^2 S C_L", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-math.md 4`] = ` -"Lift($L$) can be determined by Lift Coefficient ($C_L$) like the following -equation. - -$$ -L = \\frac{1}{2} \\rho v^2 S C_L -$$ -" -`; - -exports[`e2e legacy node-ml.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "
-This is html -
", - }, - ], - "object": "block", - "type": "html", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "block", - "type": "html", - }, - { - "data": {}, - "nodes": [ - { - "data": { - "title": null, - "url": "mailto:foobarbaz", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "mailto:foobarbaz", - }, - ], - "object": "inline", - "type": "link", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aaaaaa", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-ml.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "228", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "229", - "nodes": Immutable.List [ - Immutable.Record { - "key": "230", - "marks": Immutable.Set [], - "text": "
-This is html -
", - }, - ], - "type": "html", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "231", - "nodes": Immutable.List [ - Immutable.Record { - "key": "232", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "html", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "233", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "url": "mailto:foobarbaz", - "title": null, - }, - "key": "234", - "nodes": Immutable.List [ - Immutable.Record { - "key": "235", - "marks": Immutable.Set [], - "text": "mailto:foobarbaz", - }, - ], - "type": "link", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "236", - "nodes": Immutable.List [ - Immutable.Record { - "key": "237", - "marks": Immutable.Set [], - "text": "aaaaaa", - }, - ], - "type": "paragraph", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "230", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "230", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-ml.md 3`] = ` -{ - "children": [ - { - "type": "html", - "value": "
-This is html -
", - }, - { - "type": "html", - "value": "", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "mailto:foobarbaz", - }, - ], - "title": null, - "type": "link", - "url": "mailto:foobarbaz", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "type": "text", - "value": "aaaaaa", - }, - ], - "type": "paragraph", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-ml.md 4`] = ` -"
-This is html -
- - - - - -aaaaaa -" -`; - -exports[`e2e legacy node-paragraph.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-paragraph.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "238", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "239", - "nodes": Immutable.List [ - Immutable.Record { - "key": "240", - "marks": Immutable.Set [], - "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "241", - "nodes": Immutable.List [ - Immutable.Record { - "key": "242", - "marks": Immutable.Set [], - "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", - }, - ], - "type": "paragraph", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "240", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "240", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-paragraph.md 3`] = ` -{ - "children": [ - { - "children": [ - { - "type": "text", - "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "type": "text", - "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", - }, - ], - "type": "paragraph", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-paragraph.md 4`] = ` -"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -" -`; - -exports[`e2e legacy node-phrasing-1.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "aaa ", - }, - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "aaaaaaa", - }, - { - "marks": [], - "object": "text", - "text": " aaaaaa ", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - ], - "object": "text", - "text": "aaaaaaaa", - }, - { - "marks": [], - "object": "text", - "text": " aaaaaaaa ", - }, - { - "marks": [ - { - "object": "mark", - "type": "delete", - }, - ], - "object": "text", - "text": "aaaaaaa", - }, - { - "marks": [], - "object": "text", - "text": " aaaa ", - }, - { - "marks": [ - { - "object": "mark", - "type": "inlineCode", - }, - ], - "object": "text", - "text": "aaaaaaaa", - }, - { - "marks": [], - "object": "text", - "text": " aaa -aaa", - }, - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - { - "object": "mark", - "type": "emphasis", - }, - ], - "object": "text", - "text": "aa", - }, - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - { - "object": "mark", - "type": "delete", - }, - ], - "object": "text", - "text": "aa", - }, - { - "marks": [], - "object": "text", - "text": "aaa ", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - ], - "object": "text", - "text": "aa ", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "a ", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - { - "object": "mark", - "type": "strong", - }, - { - "object": "mark", - "type": "delete", - }, - ], - "object": "text", - "text": "aa", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": " aa ", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - { - "object": "mark", - "type": "strong", - }, - { - "object": "mark", - "type": "inlineCode", - }, - ], - "object": "text", - "text": "aaa", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": " aaaaa", - }, - { - "marks": [ - { - "object": "mark", - "type": "emphasis", - }, - ], - "object": "text", - "text": " aaaa", - }, - { - "marks": [], - "object": "text", - "text": " aa", - }, - { - "marks": [ - { - "object": "mark", - "type": "inlineCode", - }, - ], - "object": "text", - "text": "a*aa*aa_aa_a~~aa~~a", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "depth": 1, - }, - "nodes": [ - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "heading", - }, - ], - "object": "block", - "type": "heading", - }, - { - "data": { - "ordered": false, - "spread": false, - "start": null, - }, - "nodes": [ - { - "data": { - "checked": null, - "spread": false, - }, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "list", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "listItem", - }, - ], - "object": "block", - "type": "list", - }, - { - "data": {}, - "nodes": [ - { - "data": {}, - "nodes": [ - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "quote", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "block", - "type": "blockquote", - }, - { - "data": {}, - "nodes": [ - { - "data": { - "title": null, - "url": "https://github.com/", - }, - "nodes": [ - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "link to GitHub.com", - }, - ], - "object": "inline", - "type": "link", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "data": { - "title": null, - "url": "https://github.com/", - }, - "nodes": [ - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "link to GitHub.com", - }, - ], - "object": "inline", - "type": "link", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "data": { - "alt": "image", - "title": null, - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "inline", - "type": "image", - }, - ], - "object": "block", - "type": "paragraph", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-phrasing-1.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "243", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "244", - "nodes": Immutable.List [ - Immutable.Record { - "key": "245", - "marks": Immutable.Set [], - "text": "aaa ", - }, - Immutable.Record { - "key": "246", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "aaaaaaa", - }, - Immutable.Record { - "key": "247", - "marks": Immutable.Set [], - "text": " aaaaaa ", - }, - Immutable.Record { - "key": "248", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - ], - "text": "aaaaaaaa", - }, - Immutable.Record { - "key": "249", - "marks": Immutable.Set [], - "text": " aaaaaaaa ", - }, - Immutable.Record { - "key": "250", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "delete", - }, - ], - "text": "aaaaaaa", - }, - Immutable.Record { - "key": "251", - "marks": Immutable.Set [], - "text": " aaaa ", - }, - Immutable.Record { - "key": "252", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "inlineCode", - }, - ], - "text": "aaaaaaaa", - }, - Immutable.Record { - "key": "253", - "marks": Immutable.Set [], - "text": " aaa -aaa", - }, - Immutable.Record { - "key": "254", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - ], - "text": "aa", - }, - Immutable.Record { - "key": "255", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "delete", - }, - ], - "text": "aa", - }, - Immutable.Record { - "key": "256", - "marks": Immutable.Set [], - "text": "aaa ", - }, - Immutable.Record { - "key": "257", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - ], - "text": "aa ", - }, - Immutable.Record { - "key": "258", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "a ", - }, - Immutable.Record { - "key": "259", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "delete", - }, - ], - "text": "aa", - }, - Immutable.Record { - "key": "260", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": " aa ", - }, - Immutable.Record { - "key": "261", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "inlineCode", - }, - ], - "text": "aaa", - }, - Immutable.Record { - "key": "262", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": " aaaaa", - }, - Immutable.Record { - "key": "263", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "emphasis", - }, - ], - "text": " aaaa", - }, - Immutable.Record { - "key": "264", - "marks": Immutable.Set [], - "text": " aa", - }, - Immutable.Record { - "key": "265", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "inlineCode", - }, - ], - "text": "a*aa*aa_aa_a~~aa~~a", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "depth": 1, - }, - "key": "266", - "nodes": Immutable.List [ - Immutable.Record { - "key": "267", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "heading", - }, - ], - "type": "heading", - }, - Immutable.Record { - "data": Immutable.Map { - "ordered": false, - "start": null, - "spread": false, - }, - "key": "268", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "checked": null, - "spread": false, - }, - "key": "269", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "270", - "nodes": Immutable.List [ - Immutable.Record { - "key": "271", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "list", - }, - ], - "type": "paragraph", - }, - ], - "type": "listItem", - }, - ], - "type": "list", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "272", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "273", - "nodes": Immutable.List [ - Immutable.Record { - "key": "274", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "quote", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockquote", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "275", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "url": "https://github.com/", - "title": null, - }, - "key": "276", - "nodes": Immutable.List [ - Immutable.Record { - "key": "277", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "link to GitHub.com", - }, - ], - "type": "link", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "278", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "url": "https://github.com/", - "title": null, - }, - "key": "279", - "nodes": Immutable.List [ - Immutable.Record { - "key": "280", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "link to GitHub.com", - }, - ], - "type": "link", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "281", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - "title": null, - "alt": "image", - }, - "key": "282", - "nodes": Immutable.List [ - Immutable.Record { - "key": "283", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "image", - }, - ], - "type": "paragraph", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "245", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "245", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-phrasing-1.md 3`] = ` -{ - "children": [ - { - "children": [ - { - "type": "text", - "value": "aaa ", - }, - { - "children": [ - { - "type": "text", - "value": "aaaaaaa", - }, - ], - "type": "strong", - }, - { - "type": "text", - "value": " aaaaaa ", - }, - { - "children": [ - { - "type": "text", - "value": "aaaaaaaa", - }, - ], - "type": "emphasis", - }, - { - "type": "text", - "value": " aaaaaaaa ", - }, - { - "children": [ - { - "type": "text", - "value": "aaaaaaa", - }, - ], - "type": "delete", - }, - { - "type": "text", - "value": " aaaa ", - }, - { - "type": "inlineCode", - "value": "aaaaaaaa", - }, - { - "type": "text", - "value": " aaa -aaa", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "aa", - }, - ], - "type": "strong", - }, - ], - "type": "emphasis", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "aa", - }, - ], - "type": "delete", - }, - ], - "type": "strong", - }, - { - "type": "text", - "value": "aaa ", - }, - { - "children": [ - { - "type": "text", - "value": "aa ", - }, - { - "children": [ - { - "type": "text", - "value": "a ", - }, - { - "children": [ - { - "type": "text", - "value": "aa", - }, - ], - "type": "delete", - }, - { - "type": "text", - "value": " aa ", - }, - { - "type": "inlineCode", - "value": "aaa", - }, - { - "type": "text", - "value": " aaaaa", - }, - ], - "type": "strong", - }, - { - "type": "text", - "value": " aaaa", - }, - ], - "type": "emphasis", - }, - { - "type": "text", - "value": " aa", - }, - { - "type": "inlineCode", - "value": "a*aa*aa_aa_a~~aa~~a", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "heading", - }, - ], - "type": "strong", - }, - ], - "depth": 1, - "type": "heading", - }, - { - "children": [ - { - "checked": null, - "children": [ - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "list", - }, - ], - "type": "strong", - }, - ], - "type": "paragraph", - }, - ], - "spread": false, - "type": "listItem", - }, - ], - "ordered": false, - "spread": false, - "start": null, - "type": "list", - }, - { - "children": [ - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "quote", - }, - ], - "type": "strong", - }, - ], - "type": "paragraph", - }, - ], - "type": "blockquote", - }, - { - "children": [ - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "link to GitHub.com", - }, - ], - "type": "strong", - }, - ], - "title": null, - "type": "link", - "url": "https://github.com/", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "link to GitHub.com", - }, - ], - "type": "strong", - }, - ], - "title": null, - "type": "link", - "url": "https://github.com/", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "alt": "image", - "title": null, - "type": "image", - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - }, - ], - "type": "paragraph", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-phrasing-1.md 4`] = ` -"aaa **aaaaaaa** aaaaaa _aaaaaaaa_ aaaaaaaa ~~aaaaaaa~~ aaaa \`aaaaaaaa\` aaa -aaa_**aa**_**~~aa~~**aaa _aa **a ~~aa~~ aa \`aaa\` aaaaa** aaaa_ aa\`a*aa*aa_aa_a~~aa~~a\` - -# **heading** - -- **list** - -> **quote** - -[**link to GitHub.com**](https://github.com/) - -[**link to GitHub.com**](https://github.com/) - -![image](https://github.githubassets.com/images/modules/logos_page/Octocat.png) -" -`; - -exports[`e2e legacy node-phrasing-2.md 1`] = ` -{ - "document": { - "nodes": [ - { - "data": {}, - "nodes": [ - { - "data": { - "title": "link-title", - "url": "https://github.com/", - }, - "nodes": [ - { - "marks": [ - { - "object": "mark", - "type": "strong", - }, - ], - "object": "text", - "text": "link to GitHub.com", - }, - ], - "object": "inline", - "type": "link", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "data": { - "alt": "image", - "title": "image-title", - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "inline", - "type": "image", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "data": { - "identifier": "link-ref", - "label": "link-ref", - "referenceType": "full", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "alpha", - }, - ], - "object": "inline", - "type": "linkReference", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": {}, - "nodes": [ - { - "data": { - "alt": "blavo", - "identifier": "image-ref", - "label": "image-ref", - "referenceType": "full", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "inline", - "type": "imageReference", - }, - ], - "object": "block", - "type": "paragraph", - }, - { - "data": { - "identifier": "link-ref", - "label": "link-ref", - "title": null, - "url": "example.com", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "block", - "type": "definition", - }, - { - "data": { - "identifier": "image-ref", - "label": "image-ref", - "title": null, - "url": "example.gif", - }, - "nodes": [ - { - "marks": [], - "object": "text", - "text": "", - }, - ], - "object": "block", - "type": "definition", - }, - ], - "object": "document", - }, - "object": "value", -} -`; - -exports[`e2e legacy node-phrasing-2.md 2`] = ` -Immutable.Record { - "annotations": Immutable.Map {}, - "data": Immutable.Map {}, - "document": Immutable.Record { - "data": Immutable.Map {}, - "key": "284", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map {}, - "key": "285", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "url": "https://github.com/", - "title": "link-title", - }, - "key": "286", - "nodes": Immutable.List [ - Immutable.Record { - "key": "287", - "marks": Immutable.Set [ - Immutable.Record { - "data": Immutable.Map {}, - "type": "strong", - }, - ], - "text": "link to GitHub.com", - }, - ], - "type": "link", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "288", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - "title": "image-title", - "alt": "image", - }, - "key": "289", - "nodes": Immutable.List [ - Immutable.Record { - "key": "290", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "image", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "291", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "referenceType": "full", - "identifier": "link-ref", - "label": "link-ref", - }, - "key": "292", - "nodes": Immutable.List [ - Immutable.Record { - "key": "293", - "marks": Immutable.Set [], - "text": "alpha", - }, - ], - "type": "linkReference", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map {}, - "key": "294", - "nodes": Immutable.List [ - Immutable.Record { - "data": Immutable.Map { - "alt": "blavo", - "referenceType": "full", - "identifier": "image-ref", - "label": "image-ref", - }, - "key": "295", - "nodes": Immutable.List [ - Immutable.Record { - "key": "296", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "imageReference", - }, - ], - "type": "paragraph", - }, - Immutable.Record { - "data": Immutable.Map { - "identifier": "link-ref", - "label": "link-ref", - "url": "example.com", - "title": null, - }, - "key": "297", - "nodes": Immutable.List [ - Immutable.Record { - "key": "298", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "definition", - }, - Immutable.Record { - "data": Immutable.Map { - "identifier": "image-ref", - "label": "image-ref", - "url": "example.gif", - "title": null, - }, - "key": "299", - "nodes": Immutable.List [ - Immutable.Record { - "key": "300", - "marks": Immutable.Set [], - "text": "", - }, - ], - "type": "definition", - }, - ], - }, - "selection": Immutable.Record { - "anchor": Immutable.Record { - "key": "287", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - 0, - ], - }, - "focus": Immutable.Record { - "key": "287", - "offset": 0, - "path": Immutable.List [ - 0, - 0, - 0, - ], - }, - "isFocused": false, - "marks": null, - }, -} -`; - -exports[`e2e legacy node-phrasing-2.md 3`] = ` -{ - "children": [ - { - "children": [ - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "link to GitHub.com", - }, - ], - "type": "strong", - }, - ], - "title": "link-title", - "type": "link", - "url": "https://github.com/", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "alt": "image", - "title": "image-title", - "type": "image", - "url": "https://github.githubassets.com/images/modules/logos_page/Octocat.png", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "children": [ - { - "type": "text", - "value": "alpha", - }, - ], - "identifier": "link-ref", - "label": "link-ref", - "referenceType": "full", - "type": "linkReference", - }, - ], - "type": "paragraph", - }, - { - "children": [ - { - "alt": "blavo", - "identifier": "image-ref", - "label": "image-ref", - "referenceType": "full", - "type": "imageReference", - }, - ], - "type": "paragraph", - }, - { - "identifier": "link-ref", - "label": "link-ref", - "title": null, - "type": "definition", - "url": "example.com", - }, - { - "identifier": "image-ref", - "label": "image-ref", - "title": null, - "type": "definition", - "url": "example.gif", - }, - ], - "type": "root", -} -`; - -exports[`e2e legacy node-phrasing-2.md 4`] = ` -"[**link to GitHub.com**](https://github.com/ "link-title") - -![image](https://github.githubassets.com/images/modules/logos_page/Octocat.png "image-title") - -[alpha][link-ref] - -![blavo][image-ref] - -[link-ref]: example.com - -[image-ref]: example.gif -" -`; - exports[`e2e node-break.md 1`] = ` [ { @@ -8669,17 +1918,6 @@ exports[`e2e node-footnotes.md 1`] = ` "label": "1", "type": "footnoteReference", }, - { - "text": ". And this is also ", - }, - { - "children": [ - { - "text": "inline footnote", - }, - ], - "type": "footnote", - }, { "text": ".", }, @@ -8718,19 +1956,6 @@ exports[`e2e node-footnotes.md 2`] = ` "label": "1", "type": "footnoteReference", }, - { - "type": "text", - "value": ". And this is also ", - }, - { - "children": [ - { - "type": "text", - "value": "inline footnote", - }, - ], - "type": "footnote", - }, { "type": "text", "value": ".", @@ -8760,7 +1985,7 @@ exports[`e2e node-footnotes.md 2`] = ` `; exports[`e2e node-footnotes.md 3`] = ` -"This is footnote[^1]. And this is also ^[inline footnote]. +"This is footnote[^1]. [^1]: Here is the footnote. " @@ -9893,7 +3118,7 @@ aaa_**aa**_**~~aa~~**aaa _aa **a ~~aa~~ aa \`aaa\` aaaaa** aaaa_ aa\`a*aa*aa_aa_ # **heading** -- **list** +- **list** > **quote** @@ -10189,10 +3414,10 @@ exports[`issues issue42 1`] = ` `; exports[`issues issue42 2`] = ` -"- list - - list -- list -- list +"- list + - list +- list +- list - " `; @@ -10626,9 +3851,9 @@ exports[`options override builders 2`] = ` `; exports[`options override builders 3`] = ` -"- AAAA - - BBBB +"- AAAA + - BBBB -- CCCC +- CCCC " `; diff --git a/src/index.spec.ts b/src/index.spec.ts index 501eaa09..32b89deb 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -4,17 +4,11 @@ import path from "path"; import { unified } from "unified"; import markdown from "remark-parse"; import gfm from "remark-gfm"; -import footnotes from "remark-footnotes"; import frontmatter from "remark-frontmatter"; import math from "remark-math"; import stringify from "remark-stringify"; -import { - remarkToSlate, - slateToRemark, - remarkToSlateLegacy, - slateToRemarkLegacy, -} from "."; -import { Value } from "slate_legacy"; +import { remarkToSlate, slateToRemark } from "."; +import { Root } from "mdast"; const FIXTURE_PATH = "../fixtures"; @@ -22,14 +16,11 @@ describe("e2e", () => { const toSlateProcessor = unified() .use(markdown) .use(gfm) - .use(footnotes, { inlineNotes: true }) .use(frontmatter, ["yaml", "toml"]) .use(math) .use(remarkToSlate); const toRemarkProcessor = unified() - .use(slateToRemark) .use(gfm) - .use(footnotes, { inlineNotes: true }) .use(frontmatter, ["yaml", "toml"]) .use(math) .use(stringify, { bullet: "-", emphasis: "_" }); @@ -43,51 +34,10 @@ describe("e2e", () => { ).result; expect(slateNodes).toMatchSnapshot(); - const mdastTree = toRemarkProcessor.runSync({ - type: "root", - children: slateNodes, - }); - expect(mdastTree).toMatchSnapshot(); - - const text = toRemarkProcessor.stringify(mdastTree); - expect(text).toMatchSnapshot(); - }); - }); -}); - -describe("e2e legacy", () => { - const toSlateProcessor = unified() - .use(markdown) - .use(gfm) - .use(footnotes, { inlineNotes: true }) - .use(frontmatter, ["yaml", "toml"]) - .use(math) - .use(remarkToSlateLegacy); - const toRemarkProcessor = unified() - .use(slateToRemarkLegacy) - .use(gfm) - .use(footnotes, { inlineNotes: true }) - .use(frontmatter, ["yaml", "toml"]) - .use(math) - .use(stringify, { bullet: "-", emphasis: "_" }); - - const fixturesDir = path.join(__dirname, FIXTURE_PATH); - const filenames = fs.readdirSync(fixturesDir); - filenames.forEach((filename) => { - it(filename, () => { - const value: any = toSlateProcessor.processSync( - fs.readFileSync(path.join(fixturesDir, filename)) - ).result; - expect(value).toMatchSnapshot(); - expect(Value.fromJSON(value)).toMatchSnapshot(); - - const mdastTree = toRemarkProcessor.runSync({ - type: "root", - children: value.document.nodes, - } as any); + const mdastTree = toRemarkProcessor.runSync(slateToRemark(slateNodes)); expect(mdastTree).toMatchSnapshot(); - const text = toRemarkProcessor.stringify(mdastTree); + const text = toRemarkProcessor.stringify(mdastTree as Root /* FIXME */); expect(text).toMatchSnapshot(); }); }); @@ -111,8 +61,11 @@ describe("options", () => { text: (node) => ({ type: "bar", bar: node.value }), }, }); - const toRemarkProcessor = unified() - .use(slateToRemark, { + const toRemarkProcessor = unified().use(stringify, { bullet: "-" }); + const slateTree = toSlateProcessor.processSync(mdText).result; + expect(slateTree).toMatchSnapshot(); + const mdastTree = toRemarkProcessor.runSync( + slateToRemark(slateTree, { overrides: { foo: (node: any, next) => ({ type: "list", @@ -121,15 +74,9 @@ describe("options", () => { bar: (node: any) => ({ type: "text", value: node.bar }), }, }) - .use(stringify, { bullet: "-" }); - const slateTree = toSlateProcessor.processSync(mdText).result; - expect(slateTree).toMatchSnapshot(); - const mdastTree = toRemarkProcessor.runSync({ - type: "root", - children: slateTree, - }); + ); expect(mdastTree).toMatchSnapshot(); - const text = toRemarkProcessor.stringify(mdastTree); + const text = toRemarkProcessor.stringify(mdastTree as Root /* FIXME */); expect(text).toMatchSnapshot(); }); }); @@ -144,16 +91,11 @@ describe("issues", () => { - `; const toSlateProcessor = unified().use(markdown).use(remarkToSlate); - const toRemarkProcessor = unified() - .use(slateToRemark) - .use(stringify, { bullet: "-" }); + const toRemarkProcessor = unified().use(stringify, { bullet: "-" }); const slateTree = toSlateProcessor.processSync(mdText).result; expect(slateTree).toMatchSnapshot(); - const mdastTree = toRemarkProcessor.runSync({ - type: "root", - children: slateTree, - }); - const text = toRemarkProcessor.stringify(mdastTree); + const mdastTree = toRemarkProcessor.runSync(slateToRemark(slateTree)); + const text = toRemarkProcessor.stringify(mdastTree as Root /* FIXME */); expect(text).toMatchSnapshot(); }); @@ -194,15 +136,10 @@ describe("issues", () => { }, ]; const toSlateProcessor = unified().use(markdown).use(remarkToSlate); - const toRemarkProcessor = unified() - .use(slateToRemark) - .use(stringify, { emphasis: "*" }); - const mdastTree = toRemarkProcessor.runSync({ - type: "root", - children: slateNodes, - }); + const toRemarkProcessor = unified().use(stringify, { emphasis: "*" }); + const mdastTree = toRemarkProcessor.runSync(slateToRemark(slateNodes)); expect(mdastTree).toMatchSnapshot(); - const text = toRemarkProcessor.stringify(mdastTree); + const text = toRemarkProcessor.stringify(mdastTree as Root /* FIXME */); expect(text).toMatchSnapshot(); const slateTree = toSlateProcessor.processSync(text).result; expect(slateTree).toMatchSnapshot(); @@ -244,15 +181,10 @@ describe("issues", () => { }, ]; const toSlateProcessor = unified().use(markdown).use(remarkToSlate); - const toRemarkProcessor = unified() - .use(slateToRemark) - .use(stringify, { emphasis: "*" }); - const mdastTree = toRemarkProcessor.runSync({ - type: "root", - children: slateNodes, - }); + const toRemarkProcessor = unified().use(stringify, { emphasis: "*" }); + const mdastTree = toRemarkProcessor.runSync(slateToRemark(slateNodes)); expect(mdastTree).toMatchSnapshot(); - const text = toRemarkProcessor.stringify(mdastTree); + const text = toRemarkProcessor.stringify(mdastTree as Root /* FIXME */); expect(text).toMatchSnapshot(); const slateTree = toSlateProcessor.processSync(text).result; expect(slateTree).toMatchSnapshot(); @@ -267,34 +199,29 @@ describe("issues", () => { }); it("issue145", () => { - const processor = unified() - .use(slateToRemark) - .use(stringify, { emphasis: "_" }); - const ast = processor.runSync({ - type: "root", - children: [{ text: "inline code", strong: true, emphasis: true }], - } as any); + const processor = unified().use(stringify, { emphasis: "_" }); + const ast = processor.runSync( + slateToRemark([ + { text: "inline code", strong: true, emphasis: true } as any, + ]) + ); expect(ast).toMatchSnapshot(); - const text = processor.stringify(ast); + const text = processor.stringify(ast as Root /* FIXME */); expect(text).toMatchSnapshot(); }); it("issue145-2", () => { - const processor = unified() - .use(markdown) - .use(slateToRemark) - .use(stringify, { emphasis: "_" }); - const ast = processor.runSync({ - type: "root", - children: [ + const processor = unified().use(markdown).use(stringify, { emphasis: "_" }); + const ast = processor.runSync( + slateToRemark([ { type: "paragraph", children: [{ emphasis: true, inlineCode: true, text: "code" }], - }, - ], - } as any); + } as any, + ]) + ); expect(ast).toMatchSnapshot(); - const text = processor.stringify(ast); + const text = processor.stringify(ast as Root /* FIXME */); expect(text).toMatchSnapshot(); }); }); diff --git a/src/index.ts b/src/index.ts index 73546e14..6c366bce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,5 @@ export { default as remarkToSlate } from "./plugins/remark-to-slate"; export type { Options as RemarkToSlateOptions } from "./plugins/remark-to-slate"; export { default as slateToRemark } from "./plugins/slate-to-remark"; export type { Options as SlateToRemarkOptions } from "./plugins/slate-to-remark"; -export { default as slateToRemarkLegacy } from "./plugins/slate0.47-to-remark"; -export { default as remarkToSlateLegacy } from "./plugins/remark-to-slate0.47"; export { mdastToSlate } from "./transformers/mdast-to-slate"; export { slateToMdast } from "./transformers/slate-to-mdast"; diff --git a/src/models/mdast.ts b/src/models/mdast.ts index 1e96e5de..ca8f378e 100644 --- a/src/models/mdast.ts +++ b/src/models/mdast.ts @@ -2,15 +2,19 @@ import type { Literal } from "mdast"; +/** @internal */ export * from "mdast"; +/** @internal */ export * from "mdast-util-math"; +/** @internal */ export interface TOML extends Literal { type: "toml"; } +/** @internal */ declare module "mdast" { - interface FrontmatterContentMap { + interface RootContentMap { toml: TOML; } } diff --git a/src/models/slate.ts b/src/models/slate.ts index e54e0853..387d3ba2 100644 --- a/src/models/slate.ts +++ b/src/models/slate.ts @@ -2,7 +2,11 @@ import type * as slate from "slate"; +/** @internal */ export type Node = Editor | Element | Text; +/** @internal */ export type Editor = slate.Editor; +/** @internal */ export type Element = slate.Element & { type: string }; +/** @internal */ export type Text = slate.Text; diff --git a/src/plugins/remark-to-slate.ts b/src/plugins/remark-to-slate.ts index 4d282284..f1c175fb 100644 --- a/src/plugins/remark-to-slate.ts +++ b/src/plugins/remark-to-slate.ts @@ -1,20 +1,26 @@ import type { Plugin } from "unified"; -import type * as mdast from "../models/mdast"; -import type * as slate from "../models/slate"; +import type { Node } from "slate"; +import type { Root } from "mdast"; import { OverridedMdastBuilders, mdastToSlate, } from "../transformers/mdast-to-slate"; +declare module "unified" { + interface CompileResultMap { + remarkToSlateNode: Node[]; + } +} + export type Options = { overrides?: OverridedMdastBuilders; }; -const plugin: Plugin<[Options?], mdast.Root, slate.Node[]> = function ({ +const plugin: Plugin<[Options?], Root, Node[]> = function ({ overrides = {}, } = {}) { - this.Compiler = function (node) { - return mdastToSlate(node, overrides); + this.compiler = function (node) { + return mdastToSlate(node as Root, overrides); }; }; export default plugin; diff --git a/src/plugins/remark-to-slate0.47.ts b/src/plugins/remark-to-slate0.47.ts deleted file mode 100644 index 01bbaab3..00000000 --- a/src/plugins/remark-to-slate0.47.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Plugin } from "unified"; -import { mdastToSlate, SlateNode } from "../transformers/mdast-to-slate"; -import { slateToSlate047 } from "../transformers/slate-to-slate0.47"; - -const plugin: Plugin<[]> = function () { - this.Compiler = function (node) { - return slateToSlate047(mdastToSlate(node as any, {}) as SlateNode[]); - }; -}; -export default plugin; diff --git a/src/plugins/slate-to-remark.ts b/src/plugins/slate-to-remark.ts index 20e2e65e..d5b32c6e 100644 --- a/src/plugins/slate-to-remark.ts +++ b/src/plugins/slate-to-remark.ts @@ -1,6 +1,4 @@ -import type { Plugin } from "unified"; -import type * as mdast from "../models/mdast"; -import type * as slate from "../models/slate"; +import type { Node } from "slate"; import { slateToMdast, OverridedSlateBuilders, @@ -10,11 +8,6 @@ export type Options = { overrides?: OverridedSlateBuilders; }; -const plugin: Plugin<[Options?], slate.Node, mdast.Root> = ({ - overrides = {}, -} = {}) => { - return function (node) { - return slateToMdast(node, overrides); - }; +export default (nodes: Node[], { overrides = {} }: Options = {}) => { + return slateToMdast(nodes, overrides); }; -export default plugin; diff --git a/src/plugins/slate0.47-to-remark.ts b/src/plugins/slate0.47-to-remark.ts deleted file mode 100644 index eb6f0fc8..00000000 --- a/src/plugins/slate0.47-to-remark.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { Plugin } from "unified"; -import { slateToMdast } from "../transformers/slate-to-mdast"; -import { slate047ToSlate } from "../transformers/slate0.47-to-slate"; - -const plugin: Plugin<[]> = function () { - return function (node) { - return slateToMdast( - { - type: "root", - children: slate047ToSlate((node as any).children), - }, - {} - ); - }; -}; -export default plugin; diff --git a/src/transformers/mdast-to-slate/index.ts b/src/transformers/mdast-to-slate/index.ts index 5cfc77f3..3ca8f732 100644 --- a/src/transformers/mdast-to-slate/index.ts +++ b/src/transformers/mdast-to-slate/index.ts @@ -1,7 +1,12 @@ +import type { Root, RootContent } from "mdast"; +import type { Node } from "slate"; import type * as slate from "../../models/slate"; import type * as mdast from "../../models/mdast"; import { unreachable } from "../../utils"; +/** + * @internal + */ export type Decoration = Readonly<{ [key in ( | mdast.Emphasis @@ -12,20 +17,20 @@ export type Decoration = Readonly<{ }>; export type OverridedMdastBuilders = { - [key in mdast.Content["type"]]?: MdastBuilder; + [key in RootContent["type"]]?: MdastBuilder; } & ({ [key: string]: MdastBuilder } | {}); export type MdastBuilder = ( - node: T extends mdast.Content["type"] - ? Extract + node: T extends RootContent["type"] + ? Extract : unknown, next: (children: any[]) => any ) => object | undefined; export const mdastToSlate = ( - node: mdast.Root, + node: Root, overrides: OverridedMdastBuilders -): slate.Node[] => { +): Node[] => { return buildSlateRoot(node, overrides); }; @@ -37,7 +42,7 @@ const buildSlateRoot = ( }; const convertNodes = ( - nodes: mdast.Content[], + nodes: mdast.RootContent[], deco: Decoration, overrides: OverridedMdastBuilders ): slate.Node[] => { @@ -48,7 +53,7 @@ const convertNodes = ( }; const buildSlateNode = ( - node: mdast.Content, + node: mdast.RootContent, deco: Decoration, overrides: OverridedMdastBuilders ): SlateNode[] => { @@ -115,8 +120,6 @@ const buildSlateNode = ( return [buildLinkReference(node, deco, overrides)]; case "imageReference": return [buildImageReference(node)]; - case "footnote": - return [buildFootnote(node, deco, overrides)]; case "footnoteReference": return [buildFootnoteReference(node)]; case "math": @@ -130,6 +133,9 @@ const buildSlateNode = ( return []; }; +/** + * @internal + */ export type Paragraph = ReturnType; const buildParagraph = ( @@ -143,6 +149,9 @@ const buildParagraph = ( }; }; +/** + * @internal + */ export type Heading = ReturnType; const buildHeading = ( @@ -157,6 +166,9 @@ const buildHeading = ( }; }; +/** + * @internal + */ export type ThematicBreak = ReturnType; const buildThematicBreak = ({ type }: mdast.ThematicBreak) => { @@ -166,6 +178,9 @@ const buildThematicBreak = ({ type }: mdast.ThematicBreak) => { }; }; +/** + * @internal + */ export type Blockquote = ReturnType; const buildBlockquote = ( @@ -179,6 +194,9 @@ const buildBlockquote = ( }; }; +/** + * @internal + */ export type List = ReturnType; const buildList = ( @@ -195,6 +213,9 @@ const buildList = ( }; }; +/** + * @internal + */ export type ListItem = ReturnType; const buildListItem = ( @@ -215,6 +236,9 @@ const buildListItem = ( }; }; +/** + * @internal + */ export type Table = ReturnType; const buildTable = ( @@ -229,6 +253,9 @@ const buildTable = ( }; }; +/** + * @internal + */ export type TableRow = ReturnType; const buildTableRow = ( @@ -242,6 +269,9 @@ const buildTableRow = ( }; }; +/** + * @internal + */ export type TableCell = ReturnType; const buildTableCell = ( @@ -255,6 +285,9 @@ const buildTableCell = ( }; }; +/** + * @internal + */ export type Html = ReturnType; const buildHtml = ({ type, value }: mdast.HTML) => { @@ -264,6 +297,9 @@ const buildHtml = ({ type, value }: mdast.HTML) => { }; }; +/** + * @internal + */ export type Code = ReturnType; const buildCode = ({ type, value, lang, meta }: mdast.Code) => { @@ -275,6 +311,9 @@ const buildCode = ({ type, value, lang, meta }: mdast.Code) => { }; }; +/** + * @internal + */ export type Yaml = ReturnType; const buildYaml = ({ type, value }: mdast.YAML) => { @@ -284,6 +323,9 @@ const buildYaml = ({ type, value }: mdast.YAML) => { }; }; +/** + * @internal + */ export type Toml = ReturnType; const buildToml = ({ type, value }: mdast.TOML) => { @@ -293,6 +335,9 @@ const buildToml = ({ type, value }: mdast.TOML) => { }; }; +/** + * @internal + */ export type Math = ReturnType; const buildMath = ({ type, value }: mdast.Math) => { @@ -302,6 +347,9 @@ const buildMath = ({ type, value }: mdast.Math) => { }; }; +/** + * @internal + */ export type InlineMath = ReturnType; const buildInlineMath = ({ type, value }: mdast.InlineMath) => { @@ -311,6 +359,9 @@ const buildInlineMath = ({ type, value }: mdast.InlineMath) => { }; }; +/** + * @internal + */ export type Definition = ReturnType; const buildDefinition = ({ @@ -330,6 +381,9 @@ const buildDefinition = ({ }; }; +/** + * @internal + */ export type FootnoteDefinition = ReturnType; const buildFootnoteDefinition = ( @@ -345,6 +399,9 @@ const buildFootnoteDefinition = ( }; }; +/** + * @internal + */ export type Text = ReturnType; const buildText = (text: string, deco: Decoration) => { @@ -354,6 +411,9 @@ const buildText = (text: string, deco: Decoration) => { }; }; +/** + * @internal + */ export type Break = ReturnType; const buildBreak = ({ type }: mdast.Break) => { @@ -363,6 +423,9 @@ const buildBreak = ({ type }: mdast.Break) => { }; }; +/** + * @internal + */ export type Link = ReturnType; const buildLink = ( @@ -378,6 +441,9 @@ const buildLink = ( }; }; +/** + * @internal + */ export type Image = ReturnType; const buildImage = ({ type, url, title, alt }: mdast.Image) => { @@ -390,6 +456,9 @@ const buildImage = ({ type, url, title, alt }: mdast.Image) => { }; }; +/** + * @internal + */ export type LinkReference = ReturnType; const buildLinkReference = ( @@ -406,6 +475,9 @@ const buildLinkReference = ( }; }; +/** + * @internal + */ export type ImageReference = ReturnType; const buildImageReference = ({ @@ -425,19 +497,9 @@ const buildImageReference = ({ }; }; -export type Footnote = ReturnType; - -const buildFootnote = ( - { type, children }: mdast.Footnote, - deco: Decoration, - overrides: OverridedMdastBuilders -) => { - return { - type, - children: convertNodes(children, deco, overrides), - }; -}; - +/** + * @internal + */ export type FootnoteReference = ReturnType; const buildFootnoteReference = ({ @@ -453,6 +515,9 @@ const buildFootnoteReference = ({ }; }; +/** + * @internal + */ export type SlateNode = | Paragraph | Heading @@ -475,7 +540,6 @@ export type SlateNode = | Image | LinkReference | ImageReference - | Footnote | FootnoteReference | Math | InlineMath; diff --git a/src/transformers/slate-to-mdast/index.ts b/src/transformers/slate-to-mdast/index.ts index 88088f9c..42a57d77 100644 --- a/src/transformers/slate-to-mdast/index.ts +++ b/src/transformers/slate-to-mdast/index.ts @@ -1,4 +1,6 @@ import type * as unistLib from "unist"; +import type { Root } from "mdast"; +import type { Node } from "slate"; import type * as slate from "../../models/slate"; import type * as mdast from "../../models/mdast"; import type * as slateInternal from "../mdast-to-slate"; @@ -21,22 +23,15 @@ export type SlateBuilder = ( ) => object | undefined; export const slateToMdast = ( - node: slate.Node, + nodes: Node[], overrides: OverridedSlateBuilders -): mdast.Root => { - return buildMdastRoot(node, overrides); -}; - -const buildMdastRoot = ( - node: slate.Node, - overrides: OverridedSlateBuilders -): mdast.Root => { - return { +): Root => { + return { type: "root", children: convertNodes( - (node as any).children, + nodes as slate.Node[], overrides - ) as mdast.Root["children"], + ) as Root["children"], }; }; @@ -189,7 +184,7 @@ const buildMdastNode = ( node: Exclude, overrides: OverridedSlateBuilders ): Exclude< - mdast.Content | mdast.Math | mdast.InlineMath, + mdast.RootContent | mdast.Math | mdast.InlineMath, TextOrDecoration > | null => { const customNode = overrides[node.type]?.(node as any, (children) => @@ -240,8 +235,6 @@ const buildMdastNode = ( return buildLinkReference(node, overrides); case "imageReference": return buildImageReference(node); - case "footnote": - return buildFootnote(node, overrides); case "footnoteReference": return creatFootnoteReference(node); case "math": @@ -514,16 +507,6 @@ const buildImageReference = ({ }; }; -const buildFootnote = ( - { type, children }: slateInternal.Footnote, - overrides: OverridedSlateBuilders -): mdast.Footnote => { - return { - type, - children: convertNodes(children, overrides) as mdast.Footnote["children"], - }; -}; - const creatFootnoteReference = ({ type, identifier, diff --git a/src/transformers/slate-to-slate0.47.ts b/src/transformers/slate-to-slate0.47.ts deleted file mode 100644 index 1af57562..00000000 --- a/src/transformers/slate-to-slate0.47.ts +++ /dev/null @@ -1,103 +0,0 @@ -import type { - ValueJSON, - BlockJSON, - InlineJSON, - TextJSON, - MarkJSON, -} from "slate_legacy"; -import type { Decoration, SlateNode } from "./mdast-to-slate"; - -export const slateToSlate047 = (nodes: SlateNode[]): ValueJSON => { - return { - object: "value", - document: { - object: "document", - nodes: convertNodes(nodes), - }, - }; -}; - -const convertNodes = ( - nodes: SlateNode[] -): (BlockJSON | InlineJSON | TextJSON)[] => { - return nodes.reduce<(BlockJSON | InlineJSON | TextJSON)[]>((acc, n) => { - const node = convert(n as SlateNode); - if (node) { - acc.push(node); - } - return acc; - }, []); -}; - -const convert = (node: SlateNode): BlockJSON | InlineJSON | TextJSON | null => { - if ("text" in node) { - const { text, ...rest } = node; - const marks: MarkJSON[] = Object.keys(rest).reduce< - { object: "mark"; type: string }[] - >((acc, type) => { - if (!rest[type as keyof Decoration]) return acc; - acc.push({ - object: "mark", - type, - }); - return acc; - }, []); - const res: TextJSON = { - object: "text", - text, - marks, - }; - return res; - } - switch (node.type) { - case "paragraph": - case "heading": - case "blockquote": - case "list": - case "listItem": - case "table": - case "tableRow": - case "tableCell": - case "html": - case "code": - case "yaml": - case "toml": - case "thematicBreak": - case "definition": - case "break": - case "math": { - const { type, children, ...rest } = node; - const res: BlockJSON = { - object: "block", - type, - nodes: convertNodes(children as SlateNode[]), - data: { - ...rest, - }, - }; - return res; - } - case "footnoteDefinition": - case "link": - case "linkReference": - case "image": - case "imageReference": - case "footnote": - case "footnoteReference": - case "inlineMath": { - const { type, children, ...rest } = node; - const res: InlineJSON = { - object: "inline", - type, - nodes: convertNodes(children as SlateNode[]) as InlineJSON[], - data: { - ...rest, - }, - }; - return res; - } - default: - break; - } - return null; -}; diff --git a/src/transformers/slate0.47-to-slate.ts b/src/transformers/slate0.47-to-slate.ts deleted file mode 100644 index 9adc23c4..00000000 --- a/src/transformers/slate0.47-to-slate.ts +++ /dev/null @@ -1,56 +0,0 @@ -import type { BlockJSON, InlineJSON, TextJSON } from "slate_legacy"; -import type * as slate from "../models/slate"; - -export const slate047ToSlate = ( - nodes: (BlockJSON | InlineJSON | TextJSON)[] -): slate.Node[] => { - return convertNodes(nodes); -}; - -const convertNodes = ( - nodes: (BlockJSON | InlineJSON | TextJSON)[] -): slate.Node[] => { - return nodes.reduce((acc, n) => { - const node = convert(n as BlockJSON); - if (node) { - acc.push(node); - } - return acc; - }, []); -}; - -const convert = ( - node: BlockJSON | InlineJSON | TextJSON -): slate.Node | null => { - switch (node.object) { - case "block": { - const { type, nodes, data } = node; - return { - type, - children: convertNodes(nodes as BlockJSON[]), - ...data, - }; - } - case "inline": { - const { type, nodes, data } = node; - return { - type, - children: convertNodes(nodes as InlineJSON[]), - ...data, - }; - } - case "text": { - const { text = "", marks } = node; - return { - text, - ...marks?.reduce((acc, m) => { - acc[m.type] = true; - return acc; - }, {} as { [key: string]: true }), - }; - } - default: - break; - } - return null; -}; diff --git a/stories/components/slate-editor.tsx b/stories/components/slate-editor.tsx index 87b194b8..f88628ae 100644 --- a/stories/components/slate-editor.tsx +++ b/stories/components/slate-editor.tsx @@ -138,8 +138,6 @@ const renderElement = ({ break; case "imageReference": break; - case "footnote": - break; case "footnoteReference": break; default: diff --git a/stories/components/slate0.47-editor.tsx b/stories/components/slate0.47-editor.tsx deleted file mode 100644 index 4fc12d9d..00000000 --- a/stories/components/slate0.47-editor.tsx +++ /dev/null @@ -1,219 +0,0 @@ -import React, { - forwardRef, - useEffect, - useMemo, - useState, - useCallback, -} from "react"; -import { Value } from "slate_legacy"; -import { - Editor, - OnChangeParam, - RenderBlockProps, - RenderInlineProps, - RenderMarkProps, -} from "slate-react_legacy"; -import "github-markdown-css"; - -const style: React.CSSProperties = { - flex: 1, - margin: 10, - overflowY: "scroll", -}; - -type Props = { - initialValue: Value; -}; - -export default forwardRef( - ({ initialValue }: Props, ref: React.MutableRefObject) => { - const [value, setValue] = useState(initialValue); - ref.current = value; - useEffect(() => { - setValue(initialValue); - }, [initialValue]); - - const onChange = useCallback(({ value }: OnChangeParam) => { - setValue(value); - }, []); - - const renderBlock = useCallback( - ( - { node, children, attributes }: RenderBlockProps, - editor: Editor, - next: () => any - ) => { - switch (node.type) { - case "paragraph": - return

{children}

; - case "heading": { - switch (node.data.get("depth")) { - case 1: - return

{children}

; - case 2: - return

{children}

; - case 3: - return

{children}

; - case 4: - return

{children}

; - case 5: - return
{children}
; - case 6: - return
{children}
; - default: - break; - } - break; - } - case "thematicBreak": - return
; - case "blockquote": - return
{children}
; - case "list": - if (node.data.get("ordered")) { - return
    {children}
; - } else { - return
    {children}
; - } - case "listItem": - return ( -
  • - {node.data.get("checked") === true ? ( - - ) : node.data.get("checked") === false ? ( - - ) : null} - {children} -
  • - ); - case "table": - return ( - - {children} -
    - ); - case "tableRow": - return {children}; - case "tableCell": - return {children}; - case "html": - return ( -
    -                {children}
    -              
    - ); - case "code": - // TODO lang meta - return ( -
    -                {children}
    -              
    - ); - case "yaml": - case "toml": - return ( -
    -                {children}
    -              
    - ); - case "definition": - break; - case "footnoteDefinition": - break; - case "break": - break; - case "linkReference": - break; - case "imageReference": - break; - case "footnote": - break; - case "footnoteReference": - break; - default: - break; - } - return

    {children}

    ; - }, - [] - ); - - const renderInline = useCallback( - ( - { node, children, attributes }: RenderInlineProps, - editor: Editor, - next: () => any - ) => { - switch (node.type) { - case "link": - return ( - - {children} - - ); - case "image": - return ( - <> - {node.data.get("alt") - {children} - - ); - default: - break; - } - return

    {children}

    ; - }, - [] - ); - - const renderMark = useCallback( - ( - { mark, children }: RenderMarkProps, - editor: Editor, - next: () => any - ) => { - switch (mark.type) { - case "strong": - return {children}; - case "emphasis": - return {children}; - case "delete": - return {children}; - case "inlineCode": - return {children}; - default: - return next(); - } - }, - [] - ); - - return ( -
    - -
    - ); - } -); diff --git a/stories/playground/current.stories.tsx b/stories/playground/current.stories.tsx index c427333c..f5f537e7 100644 --- a/stories/playground/current.stories.tsx +++ b/stories/playground/current.stories.tsx @@ -17,18 +17,11 @@ const toSlateProcessor = unified() .use(gfm) .use(frontmatter) .use(remarkToSlate); -const toRemarkProcessor = unified() - .use(slateToRemark) - .use(gfm) - .use(frontmatter) - .use(stringify); +const toRemarkProcessor = unified().use(gfm).use(frontmatter).use(stringify); const toSlate = (s: string) => toSlateProcessor.processSync(s).result as Node[]; const toMd = (value: Node[]) => { - const mdast = toRemarkProcessor.runSync({ - type: "root", - children: value, - }); + const mdast = toRemarkProcessor.runSync(slateToRemark(value)); return toRemarkProcessor.stringify(mdast); }; diff --git a/stories/playground/legacy.stories.tsx b/stories/playground/legacy.stories.tsx deleted file mode 100644 index 990ad6d8..00000000 --- a/stories/playground/legacy.stories.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import { StoryObj } from "@storybook/react"; -import React, { useMemo, useRef, useState } from "react"; -import { Value } from "slate_legacy"; -import { unified } from "unified"; -import markdown from "remark-parse"; -import gfm from "remark-gfm"; -import frontmatter from "remark-frontmatter"; -import stringify from "remark-stringify"; -import { remarkToSlateLegacy, slateToRemarkLegacy } from "../../src"; -import SlateEditor from "../components/slate0.47-editor"; -import TextEditor from "../components/text-editor"; -import Text from "../components/text"; -import text from "../../fixtures/article.md?raw"; - -const toSlateProcessor = unified() - .use(markdown) - .use(gfm) - .use(frontmatter) - .use(remarkToSlateLegacy); -const toRemarkProcessor = unified() - .use(slateToRemarkLegacy) - .use(gfm) - .use(frontmatter) - .use(stringify); - -const toSlate = (s: string) => - Value.fromJSON(toSlateProcessor.processSync(s).result); -const toMd = (value: Value) => { - const mdast = toRemarkProcessor.runSync({ - type: "root", - children: value.toJSON().document.nodes, - }); - return toRemarkProcessor.stringify(mdast); -}; - -export default { - title: "Playground/Slate ~0.47", -}; - -const Wrapper = ({ children }: { children: React.ReactNode }) => ( -
    ({ - width: "100vw", - height: "100vh", - display: "flex", - flexDirection: "row", - fontSize: "10.5pt", - }), - [] - )} - > - {children} -
    -); - -// export const MarkdownToSlate = () => { -// const [value, setValue] = useState(toSlate(text)); -// const ref = useRef(null); -// return ( -// -// -//
    -// -//
    -// -//
    -// ); -// }; - -export const MarkdownToSlateJson: StoryObj = { - render: () => { - const [value, setValue] = useState(toSlate(text)); - const ref = useRef(null); - return ( - - -
    - -
    - {JSON.stringify(value, null, 2)} -
    - ); - }, -}; - -// export const SlateToMarkdown: StoryObj = { -// render: () => { -// const [value, setValue] = useState(toSlate(text)); -// const [md, setMd] = useState(toMd(value)); -// const ref = useRef(null); -// return ( -// -// -//
    -// -//
    -// {md} -//
    -// ); -// }, -// };