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
315
315
public function chapterToMarkdown (Chapter $ chapter ): string
316
316
{
317
317
$ 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
+
319
323
foreach ($ chapter ->pages as $ page ) {
320
324
$ text .= $ this ->pageToMarkdown ($ page ) . "\n\n" ;
321
325
}
@@ -330,6 +334,11 @@ public function bookToMarkdown(Book $book): string
330
334
{
331
335
$ bookTree = (new BookContents ($ book ))->getTree (false , true );
332
336
$ text = '# ' . $ book ->name . "\n\n" ;
337
+
338
+ if (!empty ($ book ->description )) {
339
+ $ text .= $ book ->description . "\n\n" ;
340
+ }
341
+
333
342
foreach ($ bookTree as $ bookChild ) {
334
343
if ($ bookChild instanceof Chapter) {
335
344
$ text .= $ this ->chapterToMarkdown ($ bookChild ) . "\n\n" ;
You can’t perform that action at this time.
0 commit comments