File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -315,7 +315,11 @@ public function pageToMarkdown(Page $page): string
315315 public function chapterToMarkdown (Chapter $ chapter ): string
316316 {
317317 $ text = '# ' . $ chapter ->name . "\n\n" ;
318- $ text .= $ chapter ->description . "\n\n" ;
318+
319+ if (!empty ($ chapter ->description )) {
320+ $ text .= $ chapter ->description . "\n\n" ;
321+ }
322+
319323 foreach ($ chapter ->pages as $ page ) {
320324 $ text .= $ this ->pageToMarkdown ($ page ) . "\n\n" ;
321325 }
@@ -330,6 +334,11 @@ public function bookToMarkdown(Book $book): string
330334 {
331335 $ bookTree = (new BookContents ($ book ))->getTree (false , true );
332336 $ text = '# ' . $ book ->name . "\n\n" ;
337+
338+ if (!empty ($ book ->description )) {
339+ $ text .= $ book ->description . "\n\n" ;
340+ }
341+
333342 foreach ($ bookTree as $ bookChild ) {
334343 if ($ bookChild instanceof Chapter) {
335344 $ text .= $ this ->chapterToMarkdown ($ bookChild ) . "\n\n" ;
You can’t perform that action at this time.
0 commit comments