]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Tools/ExportFormatter.php
MD Exports: Added HTML description conversion
[bookstack] / app / Entities / Tools / ExportFormatter.php
index e85992a9d70ef0909b1789b06e4b3d10c58102f3..0af68b8db3cfcd3f4f9957c0a949259a2144593b 100644 (file)
@@ -316,8 +316,9 @@ class ExportFormatter
     {
         $text = '# ' . $chapter->name . "\n\n";
 
-        if (!empty($chapter->description)) {
-            $text .= $chapter->description . "\n\n";
+        $description = (new HtmlToMarkdown($chapter->descriptionHtml()))->convert();
+        if ($description) {
+            $text .= $description . "\n\n";
         }
 
         foreach ($chapter->pages as $page) {
@@ -334,9 +335,10 @@ class ExportFormatter
     {
         $bookTree = (new BookContents($book))->getTree(false, true);
         $text = '# ' . $book->name . "\n\n";
-        
-        if (!empty($book->description)) {
-            $text .= $book->description . "\n\n";
+
+        $description = (new HtmlToMarkdown($book->descriptionHtml()))->convert();
+        if ($description) {
+            $text .= $description . "\n\n";
         }
 
         foreach ($bookTree as $bookChild) {