The Alternative to PDF: Using Sphinx to Build an EPUB
In a previous blog post, we explained why PDFs have outlived their usefulness and that you should be using the EPUB format instead. It just makes sense to use a format that gives you a wide variety of accessible and mobile-friendly options by default. But what is EPUB exactly and how does one use it?
An EPUB file is a ZIP archive that contains HTML5 files, images, CSS style sheets, and everything used to essentially make a website. It can handle most elements that are associated with modern browsers, which make’s is a great way to share documents in a format that is easy to consume however a user chooses to do so.
In looking around for a solution, Xavier, one of OpenConcept’s Drupal developers, discovered Sphinx the Python Documentation Generator. Sphinx doesn’t provide a nice WYSIWYG editor, but rather a powerful reStructuredText (reST) parser. reST is very similar to Markdown, but more powerful.
With this, ASCII markup content creators are able to focus on the content and structure and not be distracted by the formatting. Changes are easily tracked in a version control tool like Git and using tools like GitHub it is quite simple for technical people to contribute.
Sphinx allows me and others to contribute to the text. Because there is a clear separation between presentation and logic, I can work on the formatting of the document in both an EPUB and PDF format. Check out our Drupal Security Guide for an example of how effective the EPUB format can be. Now, this isn't attempting to be a desktop publishing suite, so there is a lot you can't do with it, but for many uses it is terrific.
In the end, EPUB is a great format that allows us to format the text in HTML. The process isn’t yet simple enough for non-technical folks to work through, but I am hopeful that EPUB will start to replace PDF as a mobile friendly, accessible and versatile document format.
About The Author
Mike Gifford is the founder of OpenConcept Consulting Inc, which he started in 1999. Since then, he has been particularly active in developing and extending open source content management systems to allow people to get closer to their content. Before starting OpenConcept, Mike had worked for a number of national NGOs including Oxfam Canada and Friends of the Earth.