1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Merge branch 'markdown-export' of https://github.com/nikhiljha/BookStack-1 into nikhiljha-markdown-export

This commit is contained in:
Dan Brown
2021-06-22 19:12:24 +01:00
9 changed files with 124 additions and 4 deletions

View File

@ -52,4 +52,24 @@ class BookExportController extends Controller
$textContent = $this->exportFormatter->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);
}
}