From 7ee2a50a286edf94be6ab48c174ebac0b05a6705 Mon Sep 17 00:00:00 2001 From: Daniel Weaver Date: Thu, 22 Feb 2024 15:48:21 -0500 Subject: [PATCH 1/2] Wrap contents of table header node in paragraph --- src/Nodes/TableHeader.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Nodes/TableHeader.php b/src/Nodes/TableHeader.php index 8c6cc6d..18c9abe 100644 --- a/src/Nodes/TableHeader.php +++ b/src/Nodes/TableHeader.php @@ -35,4 +35,18 @@ public function renderHTML($node, $HTMLAttributes = []) 0, ]; } + + public static function wrapper($DOMNode) + { + if ( + $DOMNode->childNodes->length === 1 + && $DOMNode->childNodes[0]->nodeName == "p" + ) { + return null; + } + + return [ + 'type' => 'paragraph', + ]; + } } From a5b1fd47c247d7176663d1120e9c1466035b5f41 Mon Sep 17 00:00:00 2001 From: Daniel Weaver Date: Thu, 22 Feb 2024 15:48:46 -0500 Subject: [PATCH 2/2] Wrap contents of table cell node in paragraph --- src/Nodes/TableCell.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Nodes/TableCell.php b/src/Nodes/TableCell.php index af2c251..c875348 100644 --- a/src/Nodes/TableCell.php +++ b/src/Nodes/TableCell.php @@ -72,4 +72,18 @@ public function renderHTML($node, $HTMLAttributes = []) 0, ]; } + + public static function wrapper($DOMNode) + { + if ( + $DOMNode->childNodes->length === 1 + && $DOMNode->childNodes[0]->nodeName == "p" + ) { + return null; + } + + return [ + 'type' => 'paragraph', + ]; + } }