Collaboratively edit & publish Markdown ebooks with Editorially, Dropbox and Leanpub

edropub is a PHP command line script that brings together Editorially, Dropbox and Leanpub to form a simple editing and publishing stack for Markdown based ebooks.

Editiorially is an excellent online Markdown editor with a focus on collaborative writing. It features tools for commenting, discussing, reviewing and comparing documents.

Leanpub is a publishing and distribution platform for ebooks that also uses Markdown as it’s source format. Following the slogan “Publish Early, Publish Often”, Leanpub encourages authors to push out their work even if it’s still in progress. It is free for authors and publishers and pays them 90% royalties minus a small, fixed charge per sale — which is rather outstanding compared to other platforms.

edropub aims to bring these remarkable tools together. As there is no direct integration between Editorially and Leanpub, Dropbox may be used as an intermediate platform. Both tools can be configured to use Dropbox as external storage.

What is the edropub workflow?

Whenever you finish working on a Markdown document and reach a stage that you would like to push out, simply publish your document to Dropbox with a single click from within the Editorially editor.

As neither Editorially nor Dropbox have support for webhooks or alike (which could be used for triggering a process whenever a Markdown document changes), an external polling mechanism has to be employed. This is what edropub does for you.

  • It connects to your Dropbox,
  • detects and downloads all newly created or modified Markdown files published by Editorially,
  • substitutes remote images against local copies,
  • changes the file extension of your Markdown documents from .md to .txt,
  • uploads all files to the Leanpub directory structure inside your Dropbox again,
  • and finally triggers the publication (or preview creation) of your Leanpub book.

While the traversal of your Markdown files is fully automated, for example the structure of your ebook still depends on additional files (like the list of chapters) which are not touched by edropub in any way. Use the tools of your liking to add and edit these files separately and directly inside your Dropbox according to the Leanpub manual.

edropub may be installed on any external server and can be called manually or periodically by a cronjob. At this very moment, each edropub installation is tied to a single ebook workflow. The edropub PHP script and it’s full documentation is freely available at GibHub.