Crowbook User Guide 0.15.0

« 7. Interactive fiction

Chapter 8
Tips and tricks

If you use Emacs as a text editor, there is a nice Markdown mode to edit Markdown files.

It is possible to use Crowbook for HTML previewing in this mode, which requires only minimal configuration and tweaking:

 '(markdown-command "crowbook - -qs  --to html --output -"))

You can then use markdown-preview (or C-c C-c p) to run Crowbook on this file and preview it in your browser. Or run markdown-live-preview-mode to see a live preview (updated each time you save your file) in Emacs’ integrated browser.

We set markdown-command to crowbook, the reason for this is a bit obvious. The arguments we give to crowbook might be a bit less obvious:

In order to embed fonts in an EPUB file, you’ll first have to edit the stylesheet, which you can first obtain with:

$ crowbook --print-template epub.css > my_epub_stylesheet.css

You’ll need to use the @font-face attribute:

@font-face {
  font-family: MyFont;
  src: url(data/my_font.ttf);

Then you can add my_font.ttf to the files that need to be added to the EPUB zip file:

title: My Book
author: Me

cover: cover.png
output.epub: book.epub

resources.files: [my_font.ttf]

(Note that you’ll have to repeat the process for the different font-weight and font-style variants of your font if you want it to display correctly when there is some text in bold, italics, or both.)

9. Contributing »