]> BookStack Code Mirror - bookstack/blobdiff - app/Util/HtmlContentFilter.php
Fixed content parsing break with line html comment
[bookstack] / app / Util / HtmlContentFilter.php
index cec927a3cef7d4ee5651ed226401bfcc3ccca4c9..11be5a0995c3dde7ec047c5a5c9290a1f8135a2e 100644 (file)
@@ -1,7 +1,6 @@
 <?php namespace BookStack\Util;
 
 use DOMDocument;
-use DOMNode;
 use DOMNodeList;
 use DOMXPath;
 
@@ -16,6 +15,7 @@ class HtmlContentFilter
             return $html;
         }
 
+        $html = '<body>' . $html . '</body>';
         libxml_use_internal_errors(true);
         $doc = new DOMDocument();
         $doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
@@ -61,11 +61,10 @@ class HtmlContentFilter
     /**
      * Removed all of the given DOMNodes.
      */
-    static protected function removeNodes(DOMNodeList $nodes): void
+    protected static function removeNodes(DOMNodeList $nodes): void
     {
         foreach ($nodes as $node) {
             $node->parentNode->removeChild($node);
         }
     }
-
-}
\ No newline at end of file
+}