]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/BookExportController.php
Merge branch 'create-content-meta-tags' of https://github.com/james-geiger/BookStack...
[bookstack] / app / Http / Controllers / BookExportController.php
index 1c1f124422f962020d31e4f35595b2e65d0f80cf..6d334ca737d62a3079d0695ee79a2601f252d923 100644 (file)
@@ -52,4 +52,14 @@ 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->exportFormatter->bookToMarkdown($book);
+        return $this->downloadResponse($textContent, $bookSlug . '.md');
+    }
 }