X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ebeca256f068761a7ca4c83bdd36ddb4337ab0bc..265f5db03f3f08665bb113191f83c49e5dae53a7:/app/Http/Controllers/ChapterExportController.php diff --git a/app/Http/Controllers/ChapterExportController.php b/app/Http/Controllers/ChapterExportController.php index 52d087442..b934eefce 100644 --- a/app/Http/Controllers/ChapterExportController.php +++ b/app/Http/Controllers/ChapterExportController.php @@ -54,4 +54,16 @@ class ChapterExportController extends Controller $chapterText = $this->exportFormatter->chapterToPlainText($chapter); return $this->downloadResponse($chapterText, $chapterSlug . '.txt'); } + + /** + * Export a chapter to a simple markdown file. + * @throws NotFoundException + */ + public function markdown(string $bookSlug, string $chapterSlug) + { + // TODO: This should probably export to a zip file. + $chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug); + $chapterText = $this->exportFormatter->chapterToMarkdown($chapter); + return $this->downloadResponse($chapterText, $chapterSlug . '.md'); + } }