namespace BookStack\Http\Controllers;
+use BookStack\Entities\Managers\BookContents;
use BookStack\Entities\ExportService;
use BookStack\Entities\Repos\BookRepo;
use Throwable;
$textContent = $this->exportService->bookToPlainText($book);
return $this->downloadResponse($textContent, $bookSlug . '.txt');
}
+
+ /**
+ * Export a book as a markdown file.
+ */
+ public function markdown(string $bookSlug)
+ {
+ $book = $this->bookRepo->getBySlug($bookSlug);
+ $textContent = $this->exportService->bookToMarkdown($book);
+ return $this->downloadResponse($textContent, $bookSlug . '.md');
+ }
+
+ /**
+ * Export a book as a zip file, made of markdown files.
+ */
+ public function zip(string $bookSlug)
+ {
+ $book = $this->bookRepo->getBySlug($bookSlug);
+ $filename = $this->exportService->bookToZip($book);
+ return response()->download($filename);
+ }
}