namespace BookStack\Http\Controllers;
+use BookStack\Entities\Managers\BookContents;
use BookStack\Entities\ExportService;
use BookStack\Entities\Repos\BookRepo;
use Throwable;
*/
public function markdown(string $bookSlug)
{
- // TODO: This should probably export to a zip file.
$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);
+ }
}