1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added markdown export endpoints to API

- Added tests to cover.
- Added slight extra spaces at content joins.
This commit is contained in:
Dan Brown
2021-06-22 21:32:55 +01:00
parent 57ea2e92ec
commit 992f03a3c0
9 changed files with 85 additions and 3 deletions

View File

@ -44,4 +44,14 @@ class PageExportApiController extends ApiController
$textContent = $this->exportFormatter->pageToPlainText($page);
return $this->downloadResponse($textContent, $page->slug . '.txt');
}
/**
* Export a page as a markdown file.
*/
public function exportMarkdown(int $id)
{
$page = Page::visible()->findOrFail($id);
$markdown = $this->exportFormatter->pageToMarkdown($page);
return $this->downloadResponse($markdown, $page->slug . '.md');
}
}