I recently wrote about playing with Node.js development on Chrome OS with Linux beta. Building on that, I decided to create a basic application for converting Fountain screenplays to EPUB 3. While the project is very much a work in progress, I wanted to write a bit about it.
For those who are unfamiliar, Fountain is a Markdown-style syntax for writing screenplays in plain text format. It focuses on readability, to the point where a plain Fountain document should almost resemble a screenplay, without any additional formatting necessary. For those who write in a professional capacity, several tools already exist for converting these files to a format suitable for submitting to Hollywood studios.
EPUB is a standard document format, typically associated with EBooks. It's used by Apple, Barnes and Noble, Google Play Books, Kobo, and Sony, among many others. Even Amazon offers tools for converting EPUB books to their proprietary Kindle format. To keep things straightforward, the format is based on Web standards, including HTML, CSS, XML, and SVG, so it plays nicely with Node.js.
To be completely clear, this project is very much in the early stages. Like, quick-and-dirty-first-attempt-at-implementing-this-functionality, early stages. There's a lot of work ahead to get things fully functional, but the project is public on GitHub, if you'd like to judge an extremely rough draft.
Currently, the application offers a command line interface, for converting documents on the local file system. In the future, I would like to be able to integrate this functionality into a web application, whether that's an online conversion tool, or a cloud based Fountain editor of some sort. Either way, I haven't gotten that far.
In the interest of rapid development, I was able to integrate Matt Daly's Fountain.js parser into the application, and make a few modifications to suit this use case. The EPUB builder is completely original, and could (theoretically) be split off into a separate project, should I (or anyone else) get the urge to experiment with more involved uses for it.
I was also able to cannibalize part of an old project of mine (from 2013!), to provide the CSS needed for displaying screenplays in HTML. While Fountain.js outputs things a little differently than what 2013-Kevin had in mind, it didn't take much to get them synced up. Since the old stylesheet uses percentages to calculate element widths, and margins, the final EPUB documents should look great on a wide range of screen sizes.
Thoughts on Using a Chromebook for this
While I started building this on the same low powered Samsung Chromebook 3 that I mentioned in the previous post, I've been reasonably content with the process, so far. That being said, I'm definitely seeing some performance concerns, even with a relatively simple application. Having multiple tabs open in Visual Studio Code, along with various Chrome tabs for referencing documentation is maybe a bit more than this particular model was built to handle. Things can stutter a bit, particularly when editing in VS Code.
Again, this machine has a dual core, fanless Intel Celeron processor, 4GB of RAM, and a sub-$200 retail price, so I'm reasonably impressed with how well it holds up. Even with the occasional performance hiccup, I'm not super anxious to move over to the Surface Pro, despite the vastly superior display, and processor. The story might be different if I were working on a larger, more demanding project, but a higher end Chromebook could probably handle it just fine.
Again, this project is still in its infancy, and will need some substantial work to be suitable for everyday use. Once it's stable, and reasonably functional, I'd like to expand it, either to power a screenplay editor of some kind, or build a more general purpose Node.js library for handling EPUB documents. And, of course, I'll need to clean things up quite a bit, and flesh out a lot of the functionality, before I can get to that point.
Still, I'm pretty enthusiastic about what I've been able to hack together, in roughly a day or two, and with a bit of a weird development environment, to boot. And, if anyone else finds it useful, or adjacent to useful, the code I've written is available under a permissive license (simplified BSD), ready to be ripped apart, hacked on, forked, or developed further.