diff --git a/packages/core/src/api/parsers/html/__snapshots__/paste/parse-google-docs-html.json b/packages/core/src/api/parsers/html/__snapshots__/paste/parse-google-docs-html.json
new file mode 100644
index 0000000000..c45e54ef9f
--- /dev/null
+++ b/packages/core/src/api/parsers/html/__snapshots__/paste/parse-google-docs-html.json
@@ -0,0 +1,476 @@
+[
+ {
+ "id": "1",
+ "type": "heading",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left",
+ "level": 1
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Heading 1",
+ "styles": {
+ "bold": true
+ }
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "2",
+ "type": "heading",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left",
+ "level": 2
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Heading 2",
+ "styles": {
+ "bold": true
+ }
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "3",
+ "type": "heading",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left",
+ "level": 3
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Heading 3",
+ "styles": {
+ "bold": true
+ }
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "4",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Paragraph 1",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "5",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Paragraph 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "6",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Paragraph 3",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "7",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Paragraph With \nHard Break",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "8",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Bold",
+ "styles": {
+ "bold": true
+ }
+ },
+ {
+ "type": "text",
+ "text": " ",
+ "styles": {}
+ },
+ {
+ "type": "text",
+ "text": "Italic",
+ "styles": {
+ "italic": true
+ }
+ },
+ {
+ "type": "text",
+ "text": " Underline ",
+ "styles": {}
+ },
+ {
+ "type": "text",
+ "text": "Strikethrough",
+ "styles": {
+ "strike": true
+ }
+ },
+ {
+ "type": "text",
+ "text": " ",
+ "styles": {}
+ },
+ {
+ "type": "text",
+ "text": "All",
+ "styles": {
+ "bold": true,
+ "italic": true,
+ "strike": true
+ }
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "9",
+ "type": "bulletListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Bullet List Item 1",
+ "styles": {}
+ }
+ ],
+ "children": [
+ {
+ "id": "10",
+ "type": "bulletListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Bullet List Item 1",
+ "styles": {}
+ }
+ ],
+ "children": [
+ {
+ "id": "11",
+ "type": "numberedListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Numbered List Item 1",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "12",
+ "type": "numberedListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Numbered List Item 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ }
+ ]
+ },
+ {
+ "id": "13",
+ "type": "bulletListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Bullet List Item 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ }
+ ]
+ },
+ {
+ "id": "14",
+ "type": "bulletListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Bullet List Item 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "15",
+ "type": "numberedListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Numbered List Item 1",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "16",
+ "type": "numberedListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Numbered List Item 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "17",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [],
+ "children": []
+ },
+ {
+ "id": "18",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "\n",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "19",
+ "type": "table",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default"
+ },
+ "content": {
+ "type": "tableContent",
+ "rows": [
+ {
+ "cells": [
+ [
+ {
+ "type": "text",
+ "text": "Cell 1",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 2",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 3",
+ "styles": {}
+ }
+ ]
+ ]
+ },
+ {
+ "cells": [
+ [
+ {
+ "type": "text",
+ "text": "Cell 4",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 5",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 6",
+ "styles": {}
+ }
+ ]
+ ]
+ },
+ {
+ "cells": [
+ [
+ {
+ "type": "text",
+ "text": "Cell 7",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 8",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 9",
+ "styles": {}
+ }
+ ]
+ ]
+ }
+ ]
+ },
+ "children": []
+ },
+ {
+ "id": "20",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Paragraph",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "21",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "\n",
+ "styles": {}
+ }
+ ],
+ "children": []
+ }
+]
\ No newline at end of file
diff --git a/packages/core/src/api/parsers/html/__snapshots__/paste/parse-notion-html.json b/packages/core/src/api/parsers/html/__snapshots__/paste/parse-notion-html.json
new file mode 100644
index 0000000000..d79fe09648
--- /dev/null
+++ b/packages/core/src/api/parsers/html/__snapshots__/paste/parse-notion-html.json
@@ -0,0 +1,470 @@
+[
+ {
+ "id": "1",
+ "type": "heading",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left",
+ "level": 1
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Heading 1",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "2",
+ "type": "heading",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left",
+ "level": 2
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Heading 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "3",
+ "type": "heading",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left",
+ "level": 3
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Heading 3",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "4",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Paragraph 1",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "5",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Paragraph 1",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "6",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Paragraph 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "7",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Paragraph With Hard Break",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "8",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Bold",
+ "styles": {
+ "bold": true
+ }
+ },
+ {
+ "type": "text",
+ "text": " ",
+ "styles": {}
+ },
+ {
+ "type": "text",
+ "text": "Italic",
+ "styles": {
+ "italic": true
+ }
+ },
+ {
+ "type": "text",
+ "text": " Underline ",
+ "styles": {}
+ },
+ {
+ "type": "text",
+ "text": "Strikethrough",
+ "styles": {
+ "strike": true
+ }
+ },
+ {
+ "type": "text",
+ "text": " ",
+ "styles": {}
+ },
+ {
+ "type": "text",
+ "text": "All",
+ "styles": {
+ "bold": true,
+ "italic": true,
+ "strike": true
+ }
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "9",
+ "type": "bulletListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Bullet List Item 1",
+ "styles": {}
+ }
+ ],
+ "children": [
+ {
+ "id": "10",
+ "type": "bulletListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Bullet List Item 1",
+ "styles": {}
+ }
+ ],
+ "children": [
+ {
+ "id": "11",
+ "type": "numberedListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Numbered List Item 1",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "12",
+ "type": "numberedListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Numbered List Item 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ }
+ ]
+ },
+ {
+ "id": "13",
+ "type": "bulletListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Nested Bullet List Item 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ }
+ ]
+ },
+ {
+ "id": "14",
+ "type": "bulletListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Bullet List Item 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "15",
+ "type": "numberedListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Numbered List Item 1",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "16",
+ "type": "numberedListItem",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Numbered List Item 2",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "17",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Background Color Paragraph",
+ "styles": {}
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "18",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "!",
+ "styles": {}
+ },
+ {
+ "type": "link",
+ "href": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg",
+ "content": [
+ {
+ "type": "text",
+ "text": "https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg",
+ "styles": {}
+ }
+ ]
+ }
+ ],
+ "children": []
+ },
+ {
+ "id": "19",
+ "type": "table",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default"
+ },
+ "content": {
+ "type": "tableContent",
+ "rows": [
+ {
+ "cells": [
+ [
+ {
+ "type": "text",
+ "text": "Cell 1",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 2",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 3",
+ "styles": {}
+ }
+ ]
+ ]
+ },
+ {
+ "cells": [
+ [
+ {
+ "type": "text",
+ "text": "Cell 4",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 5",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 6",
+ "styles": {}
+ }
+ ]
+ ]
+ },
+ {
+ "cells": [
+ [
+ {
+ "type": "text",
+ "text": "Cell 7",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 8",
+ "styles": {}
+ }
+ ],
+ [
+ {
+ "type": "text",
+ "text": "Cell 9",
+ "styles": {}
+ }
+ ]
+ ]
+ }
+ ]
+ },
+ "children": []
+ },
+ {
+ "id": "20",
+ "type": "paragraph",
+ "props": {
+ "textColor": "default",
+ "backgroundColor": "default",
+ "textAlignment": "left"
+ },
+ "content": [
+ {
+ "type": "text",
+ "text": "Paragraph",
+ "styles": {}
+ }
+ ],
+ "children": []
+ }
+]
\ No newline at end of file
diff --git a/packages/core/src/api/parsers/html/parseHTML.test.ts b/packages/core/src/api/parsers/html/parseHTML.test.ts
index 456ba2a4c5..69be9d69bb 100644
--- a/packages/core/src/api/parsers/html/parseHTML.test.ts
+++ b/packages/core/src/api/parsers/html/parseHTML.test.ts
@@ -266,4 +266,175 @@ describe("Parse HTML", () => {
await parseHTMLAndCompareSnapshots(html, "parse-div-with-inline-content");
});
+
+ it("Parse Notion HTML", async () => {
+ // A few notes on Notion output HTML:
+ // - Does not preserve text/background colors
+ // - Does not preserve non-list-item block nesting
+ // - Hard breaks are represented using white space, not `
` elements
+ // - Images are converted to links with a "!" at the start
+ // - Cells in first row of a table are converted to `th` elements, regardless
+ // of if the row is set as a header row
+
+ const html = `
Paragraph 1
+Nested Paragraph 1
+Nested Paragraph 2
+Paragraph +With Hard Break
+Bold Italic Underline Strikethrough All
Background Color Paragraph
+!https://www.pulsecarshalton.co.uk/wp-content/uploads/2016/08/jk-placeholder-image.jpg
+Cell 1 | +Cell 2 | +Cell 3 | +
---|---|---|
Cell 4 | +Cell 5 | +Cell 6 | +
Cell 7 | +Cell 8 | +Cell 9 | +
Paragraph
+`; + + await parseHTMLAndCompareSnapshots(html, "parse-notion-html"); + }); + + // Currently breaking, seems related to parsing `` elements + it.skip("Parse Google Docs HTML", async () => { + // A few notes on Google Docs output HTML: + // - All inline markup is represented as `` elements with inline + // styles (bold, italic, etc.) + // - The nested list structure is not valid, i.e. `Paragraph 1
+Paragraph 2
+Paragraph 3
+Paragraph With
Hard Break
Bold Italic Underline Strikethrough All
+Bullet List Item 1
+Nested Bullet List Item 1
+Nested Numbered List Item 1
+Nested Numbered List Item 2
+Nested Bullet List Item 2
+Bullet List Item 2
+Numbered List Item 1
+Numbered List Item 2
++
Paragraph
+ +