1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

MD Exports: Added HTML description conversion

Also updated tests to cover checking description use/conversion.
Made during review of #5313
This commit is contained in:
Dan Brown
2024-12-02 11:46:56 +00:00
parent f12946d581
commit 0f9957bc03
2 changed files with 19 additions and 5 deletions

View 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) {