Ben Crowder

Blog: #markdown

4 posts :: tag feed :: about the blog :: archive

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 via office hours

Shortform initial draft

After blogging that Shortform mockup, I kept finding myself needing the app itself, so I went ahead and started writing it. It’s very much a draft and not polished, but the core is there, and it’s usable enough that I turn to it quite often.

What’s working

  • You can create notes.
  • Notes are autosaved to a folder specified in preferences.
  • Notes are reopened when you open the app, like with Stickies.
  • User-customizable global hotkeys (using MASShortcut):
    • Show app
    • Create new note
    • Create new note with the contents of the clipboard

What’s not implemented yet

  • Console. I made a first failed attempt (which messed all the window layout up) and need to try again.
  • Title bars. I’ve decided I don’t actually want them — they look nice, but since you can drag a note using the margin on any side of the window, and since you can use keyboard shortcuts or the menu item to close the current note, the title bars aren’t really necessary.
  • Preview mode.
  • Themes.

Note that this is my first OS X app, so I’ve undoubtedly flubbed a number of things. But I do have to say that Cocoa is a very nice framework to work with — I was able to get to this point far more quickly than I expected to. And Objective-C is — dare I say it — growing on me a little.


Reply via email or via office hours

Shortform mockup

Lately I’ve been itching for a way in OS X to quickly create temporary sticky notes but with Markdown support and with decent text processing (regex find-and-replace, etc.) and with the ability to type first and act later (like Drafts for iOS). The default Stickies app doesn’t really fit the bill (and it isn’t pretty).

So I’ve mocked up an OS X app I’m calling Shortform:

I don’t know if I’ll actually write the app (Cocoa learning curve and other pressing needs, etc.), but since the likelihood of someone else writing it is very small, that may have to be what happens. Things of note:

  • Console and reusable actions. In the upper left note, you can see a console at the bottom. It’s a command line for text editing, basically. There’d be built-in commands (like replace or trim or what have you) along with ways to send the text elsewhere (email and web services being the two main ones I’d use). You would also be able to save a sequence of commands into a reusable action.
  • Keyboard shortcuts. Lots of configurable shortcuts — new note, new note with clipboard contents automatically pasted in, shortcuts for custom actions, etc. And a global shortcut to focus the app.
  • Markdown preview. The middle note (with the green header) shows a preview (processed through Markdown to HTML with some CSS). I’m thinking notes could be in either edit mode and preview mode, rather than having two separate windows.

How I think I’d use Shortform:

  • Quick text processing. I often need to do a quick regex on a snippet of text — adding hyphens to the beginning of a list of things, for example.
  • Temporary notes while I’m working on something. Stuff I need to write down but don’t care to keep in a longer-term notebook. That’s how I use Stickies right now.
  • Quick entry for blog posts, etc. I love Drafts on iOS. Type first, then do what you need to do with it. It’s particularly useful with web services — I can type a note, then send it to whichever one of my Vinci notebooks I want.

Anyway, at this point it’s just a mockup. If I do end up building it someday, I’ll let y’all know.


Reply via email or via 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 via office hours