diff --git a/packages/block-library/src/table/index.js b/packages/block-library/src/table/index.js
index 6cf466f50dc36a..78bc014bd80b04 100644
--- a/packages/block-library/src/table/index.js
+++ b/packages/block-library/src/table/index.js
@@ -18,11 +18,14 @@ import edit from './edit';
const tableContentPasteSchema = {
tr: {
+ allowEmpty: true,
children: {
th: {
+ allowEmpty: true,
children: getPhrasingContentSchema(),
},
td: {
+ allowEmpty: true,
children: getPhrasingContentSchema(),
},
},
@@ -33,12 +36,15 @@ const tablePasteSchema = {
table: {
children: {
thead: {
+ allowEmpty: true,
children: tableContentPasteSchema,
},
tfoot: {
+ allowEmpty: true,
children: tableContentPasteSchema,
},
tbody: {
+ allowEmpty: true,
children: tableContentPasteSchema,
},
},
diff --git a/packages/blocks/src/api/raw-handling/utils.js b/packages/blocks/src/api/raw-handling/utils.js
index 4395c82c429dca..896bb6b8d4a5e0 100644
--- a/packages/blocks/src/api/raw-handling/utils.js
+++ b/packages/blocks/src/api/raw-handling/utils.js
@@ -185,11 +185,17 @@ function cleanNodeList( nodeList, doc, schema, inline ) {
( ! schema[ tag ].isMatch || schema[ tag ].isMatch( node ) )
) {
if ( node.nodeType === ELEMENT_NODE ) {
- const { attributes = [], classes = [], children, require = [] } = schema[ tag ];
+ const {
+ attributes = [],
+ classes = [],
+ children,
+ require = [],
+ allowEmpty,
+ } = schema[ tag ];
// If the node is empty and it's supposed to have children,
// remove the node.
- if ( isEmpty( node ) && children ) {
+ if ( children && ! allowEmpty && isEmpty( node ) ) {
remove( node );
return;
}
diff --git a/test/integration/fixtures/markdown-in.txt b/test/integration/fixtures/markdown-in.txt
index c9856084622470..b636a781438003 100644
--- a/test/integration/fixtures/markdown-in.txt
+++ b/test/integration/fixtures/markdown-in.txt
@@ -23,6 +23,10 @@ First Header | Second Header
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column
+| | |
+|---|---|
+| | Table with empty cells. |
+
## Quote
> First
diff --git a/test/integration/fixtures/markdown-out.html b/test/integration/fixtures/markdown-out.html
index cf83cf40050c4a..ba9a33b7172cc2 100644
--- a/test/integration/fixtures/markdown-out.html
+++ b/test/integration/fixtures/markdown-out.html
@@ -31,6 +31,10 @@
Table
First Header | Second Header |
---|
Content from cell 1 | Content from cell 2 |
Content in the first column | Content in the second column |
+
+
+
+
Quote