0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-22 15:57:29 +00:00

basic markdown export

This commit is contained in:
Nikhil Jha 2020-05-12 21:12:26 -07:00
parent 9666c8c0f7
commit a34a07c610
7 changed files with 84 additions and 0 deletions
app/Http/Controllers

View file

@ -55,4 +55,16 @@ class ChapterExportController extends Controller
$chapterText = $this->exportService->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->exportService->chapterToMarkdown($chapter);
return $this->downloadResponse($chapterText, $chapterSlug . '.md');
}
}