mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Updated markdown export implementation
- Removed ZIP system for now, until the idea can be fleshed out. - Added testing to cover. - Upgraded used library. - Added custom handling for BookStack callouts. - Added HTML cleanup to better produce output for things like code blocks.
This commit is contained in:
@ -59,17 +59,7 @@ class BookExportController extends Controller
|
||||
public function markdown(string $bookSlug)
|
||||
{
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$textContent = $this->exportService->bookToMarkdown($book);
|
||||
$textContent = $this->exportFormatter->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);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class ChapterExportController extends Controller
|
||||
{
|
||||
// TODO: This should probably export to a zip file.
|
||||
$chapter = $this->chapterRepo->getBySlug($bookSlug, $chapterSlug);
|
||||
$chapterText = $this->exportService->chapterToMarkdown($chapter);
|
||||
$chapterText = $this->exportFormatter->chapterToMarkdown($chapter);
|
||||
return $this->downloadResponse($chapterText, $chapterSlug . '.md');
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class PageExportController extends Controller
|
||||
public function markdown(string $bookSlug, string $pageSlug)
|
||||
{
|
||||
$page = $this->pageRepo->getBySlug($bookSlug, $pageSlug);
|
||||
$pageText = $this->exportService->pageToMarkdown($page);
|
||||
$pageText = $this->exportFormatter->pageToMarkdown($page);
|
||||
return $this->downloadResponse($pageText, $pageSlug . '.md');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user