Home / Blog Menu ↓

Blog: #md2epub

Some quick thoughts about the project space I see myself working in (meaning personal coding projects that aren’t the productivity tools I mentioned before), both now and for the foreseeable future. To be honest, it’s mostly a roadmap for myself, posted here as part of working in public.

Bookmaking tools

One of the areas in the project space is bookmaking tools: tools that help with making either print books or ebooks. What I’ve worked on in that area (and some of these are still in progress or in the future):

  • Press — low-level typesetting (PDF compiler)
  • Ink — higher-level typesetting
  • Curves — programmatic type design
  • Typlate — type design templates
  • md2epub/Caxton — ebook compiler
  • epubdiff — ebook differ
  • Fledge — text processing shell
  • Storybook — writing tool (covered under the productivity tools, yes, but I feel it fits in here)

Creativity tools

The next area, somewhat related, is creativity tools: tools for making art, music, etc. I do realize that there’s a bit of overlap between the two areas — art can be used in books, for example. This is not a rigorous taxonomy.

What I’ve worked on:

  • Trill — music composition REPL
  • Grain — command-line tool for texturing art

While I haven’t done much in this area so far, the intersection of software and art has been calling to me more lately. I expect creativity tools to become much more of a focus for me, probably even more so than the bookmaking tools.

Human-Computer Interaction

Last but not least, HCI. My master’s thesis is in this area, and much of my other work also touches on it in limited ways. (What I mean by that, I think, is that with projects like Trill, Curves, and Press, the parts that have most interested me are the interfaces. Also, those interfaces have been textual in these particular cases, but I’m also interested in other kinds of UIs.) So I plan to start building more proofs of concept and interface experiments — like the spatial interface ideas I mentioned several weeks ago.


Reply via email or office hours

I’m getting a bit of a nostalgia kick reading through the Standard Ebooks process. I haven’t made anything with them (though they do good work and I’m reading two of their editions right now), but years ago — in a former life, it seems — I used to make ebook editions of old books.

As far as I can tell, the first ebook I made was Chesterton’s The Ball and the Cross, which I typed up by hand and posted to Project Gutenberg. Around that time I worked on a handful of other books for PG, including Henry Sweet’s An Icelandic Primer, which was much more involved (Old Icelandic characters, tables, etc.) and incredibly fun.

After that I worked on several more books as part of the Mormon Texts Project and also started making EPUB and Kindle editions of other books (like the 1812/1815 edition of Grimms’ fairy tales and George MacDonald’s The Light Princess). Those were quite fun, too.

Somewhere around five or so years ago I stopped, partly from working on other things, partly from repetitive strain injuries. (Even with Vim macros to help, there’s still a multitude of repetitive keystrokes in cleaning up texts, at least for me.) With reading about Standard Ebooks and writing this post, though, I’m tempted to get back into it. I built Fledge years ago as an attempt to script away more of the repetitive work, and I suspect wiser use of both it and Vim might be enough to minimize the RSI.

On a related note, I’ve been wanting to rewrite md2epub. It’s a decent-enough Python script that takes Markdown files and turns them into an EPUB, and it’s worked well. But it’s an old codebase, and I don’t like the name anymore, and it could be faster, and I have a few ideas on how to make it more ergonomic, so I’m planning to dub it Caxton and rewrite it in Go or Rust. (Primarily so I’ll have an easier way to make EPUB editions of my fiction.) This part is the most likely to actually happen, I think.


Reply via email or office hours

md2epub

An itch scratched: md2epub, a Python script for making an EPUB out of Markdown files.

All it takes is a simple book file, which gives the script some basic metadata about the book and then lists the files that need to be included. The script runs Markdown on the files and makes an EPUB.

# Sample book file for md2epub
# 9 Jun 2010

Title: My Sample Book
Author: John Doe
Language: en-US
URL: /books/my-sample-book/
CSS: content/style.css

# Chapters
Foreword | content/foreword.text
Chapter 1 | content/chapter_1.text
Chapter 2 | content/chapter_2.text
Chapter 3 | content/chapter_3.text

# Images to be included
Images: images/illustration1.jpg, images/illustration2.jpg
Image: images/illustration4.jpg

And then you just run “md2epub myfile.book” and voila, instant EPUB. I’ve already used it on my Pearl of Great Price reader’s edition (which I’ll be releasing shortly) and it works like a charm.

Last but not least, the code is based on my friend Matt’s script GetBook.py. (And, in fact, that’s where I got the idea for this script.)


Reply via email or office hours