The BookStack utility has been updated to support exporting content from BookStack. The primary influence behind this update is to assist in consolidating documentation/notes across various tools/services;
Table of Contents
The BookStack Utility now supports:
- Importing static HTML content (such as exports from Atlassian Confluence)
- New: Exporting content from BookStack as complete books or books > pages.
Feel free to adapt this to your own requirements.
Usage Instructions
Authentication
To test you could create a credentials file: credentials.php
and include your Rest API credentials from BookStack:
Generate a token in BookStack by:
- Logging in > User profile (top right) > Edit Profile > Scroll to API tokens and generate.
- Note: User access to books/pages based on role membership.
$credentials = array(
'url' => "<bookstack-path>",
'id' => "<id>",
'secret' => "<api-token>"
);
Export as books
See examples/export_as_book.php
for a working example.
require_once('../bookstack_client.php');
require_once('./credentials.php');
if (!isset($credentials)) {
die("Missing `credentials` array; exiting now.");
}
$europa = new BookStack_Client($credentials['url'], $credentials['id'], $credentials['secret'], true);
// Set a custom path - uncomment below
// $europa->update_output_path("/test/");
// Export all books
$europa->export_all_books();
- Run the export_by_book.php file; will export each entire book as a single markdown file using the books slug name as the file title.
Export as pages
See examples/export_as_page.php
for a working example.
require_once('../bookstack_client.php');
require_once('./credentials.php');
if (!isset($credentials)) {
die("Missing `credentials` array; exiting now.");
}
$europa = new BookStack_Client($credentials['url'], $credentials['id'], $credentials['secret'], true);
// Set a custom path - uncomment below
// $europa->update_output_path("/test/");
// Export all pages
// Uses book slug name as sub-directory for each page.
$europa->export_all_pages();
- Run the export_by_book.php file; will export each entire book as a single markdown file using the books slug name as the file title.