Skip to content

gloverab/confluence-server-to-bookstack-importer

Repository files navigation

IMPORTANT NOTE

This was created for a specific client, and worked for their use case. It is not actively maintained. I do not have ongoing access to Confluence test data structures or a Bookstack instance, and therefore cannot build or test new features. That said, if you have data/infrastructure for me to work with, let's chat and get this project more useable for all.

In the meantime, if you're looking for a more fully fledged solution, check out https://github.com/transcriptionstream/confluence-to-bookstack-wizard, which uses this project as the backbone.

Confluence Server To Bookstack Importer

You'll need basically any version of node installed.

Get Started

  • Set your .env variables.
  • cd to this directory
  • npm install
  • Create an .env file and fill in your details following the format provided in .env-example.

Functionality

You can import 1 shelf at a time from a Confluence HTML export.

BookStack does not support putting Pages directly on Shelves. Nor does it support a large amount of HTML directly on a Book.

To fit the freeform nature of Confluence into BookStack's structure, for any "pages" that live directly on a "shelf" in Confluence, the importer will create a Book with a single page, titled "_General."

In the example below, any HTML content on "Our Services" and "Network Overview" will be turned into a "_General" page, and nested in the "Our Services" book. Other than that caveat, if your index.html looks anything like the one below, you'll be in good shape.

Example index.html File

  • Images displayed in the HTML will be automatically uploaded
  • Embedded links to other docs will be updated with best guess of what the new URL will be, based on BookStack's slugify function and URL generation. This will get a little wonky if there are duplicate filenames, and there's definitely a chance I missed something.
  • Attachments is a separate script and must be run after importing. More on that below.

Usage

You should do a full Confluence HTML export and leave all the html files, attachments, images, and styles in place. You can move the whole folder wherever you want and define the path to the HTML in your .env file.

Importing a shelf

To import a folder of HTML files to bookstack, run: npm run import <subdirectory-in-html-folder>

For example, if you're trying to import ./html/ITDocs:

  • Your .env PATH_TO_HTML would be set to ./html
  • You would run npm run import ITDocs

Importing Attachments

To import a shelf, you MUST have imported the shelf first. The shelf import script stores the attachment paths and their corresponding IDs in attachmentsFile.js, and it's crucial that the IDs are correct. Once the import script has successfully run on a folder:

  • run npm run attach ITDocs

Delete books by shelf

To delete all the books for a shelf:

  • run npm run killShelf
  • You will receive a list of existing shelves and their IDs, and you will be prompted to enter an ID for the shelf whose books you'd like to delete. Enter the id (ex. 257) and hit Enter.

Nuke

You can delete everything by running: node nuke.js

Caveats

This is a work in progress. It currently does not import images and attachments.

About

No description, website, or topics provided.

Resources

License

Stars

10 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors