I’ve discovered pandoc

I have discovered pandoc. Oh dear.

It has garnered an immediate place in my backup routine and has filled a gap that my switch from Microsoft Word to LibreOffice Writer created in my editing and proofreading routine.

And I’ve discovered that I like reading the HTML version of my document better than the EPUB when I’m proofreading because paragraphs are spaced automatically instead of appearing in book form and that makes for really easy reading to pick out mistakes.

It’s also super easy to open an HTML file from Dropbox on my phone and tablets.

So, here’s how I made it work for me, in my routine. Maybe you’ll get a few ideas from this that’ll work for you.

First I installed pandoc. It is a command line tool so that’s a big deal for me. I don’t do command line work. I can, if I have to, but only if I’m looking at a cheat sheet. I have no advanced knowledge of command line stuff so what I present here is what I found in the pandoc documentation that worked for me.

One thing I do know how to do is create a .bat file for windows. I know only a few things about that, though, too.

That said, I know just enough to know it would be possible to do the thing I wanted to do once I realized how cool pandoc was.

So, let me start again: I installed pandoc. https://pandoc.org/

I followed the super easy installation method. I downloaded the windows installation file and ran it. :-)

The pandoc website is super easy to browse and I browsed right through the About, Installing, and Getting started pages. I skimmed the Demos and searched a bit of the Documenation at points too, but pandoc is really easy to use if you can just get the command line stuff right.

So here’s a cheat sheet. :D

It’s nothing special, but maybe seeing it will give you ideas.

I store my working files in a structure like this:

\users\myusername\files\publishing\works\series-name\01-book-title\

I do it that way so all my book folders are in the order I wrote them and not in some other random order.

I don’t even bother with the command line / terminal. I put my stuff in a .bat file that I created in notepad. Seriously.

I knew about .bat files and have used them for backing up files in the past. So I combined that with the stuff I discovered about pandoc and made a file that will generate a format for me and save it somewhere just by me clicking the file and “opening” it. .bat files don’t really open so much as they “run” so that’s what’s actually happening.

I click the file to open it and it runs. :D

Oh, and just to note, I’m using Windows 7. I don’t use Windows 10 so I have no idea if this stuff is just as easy there or not.

Once pandoc is installed, just right click in the folder where you store your book file and choose New Text Document from the context menu.

Here are supporting pictures to show me walking through what I did last night but in a dummy folder this time.

I made a new text file.

I named it “formats.bat”.

The file tries to default to “formats.bat.txt,” but I just deleted .txt so that the file is a .bat file. You’ll get a warning. Tell it you know what you’re doing and to rename the file extension.

Since I didn’t want to have to type up a crazy long file path, I had to make sure my file was actually in the directory where I put the .bat file.

If I’d been using one of my real book files like I did last night, this wouldn’t have been necessary because the file would have already been there. But that’s the problem wtih dummy folders. You’ve got to fill them with dummy files. :-)

Now I edit the file and put the pandoc command line stuff in it so that it’ll generate a couple of alternate formats and spit them out.

Here’s what’s in that file for easy copying and pasting:

pandoc book-title.odt -s -o book-title-draft.epub --metadata title="Book Title draft" --metadata author="Your Name"
pandoc book-title.odt -s -o book-title-draft.html --metadata title="Book Title draft" --metadata author="Your Name"

It won’t ask about overwriting files. So BE SURE you don’t mess up those file names and that you don’t mind having the files overwritten.

Just swap out “book-title.odt” for your file name.

Pandoc does handle .docx files too so you could start from that rather than an .odt file like I do. Also swap out the “book-title-draft.epub” (and .html) file for whatever name you’d like. Finally, the –metadata stuff is only relevant to certain file types so it isn’t needed for all conversions, say book-title.odt to book-title.txt. :-)

I use this to generate backup formats for my book, including a plain .txt file, and I actually have the EPUB and HTML files saved to my Dropbox folder instead of the directory it’s in so that I can open that file on my phone and do my editing read-through there or on a tablet.

These will be basic files, nothing fancy, but they are perfect for me to do my editing read-throughs that I do as I go, or as backup formats.

If you’re the type that prefers to start with something other than a blank document, you can take the EPUB or HTML into Sigil or Jutoh and tweak it there at the end if need be. I prefer to import my formatted word processing file for that into Jutoh, but it’s something I might look at just to see about when I get that far with my current book. :-)

It’s a one-click document generation and backup solution.

It is so easy. I love it. :D