Gem Version Build Status Maintainability Dependency Status

Cheepub is EPUB/PDF generator from Markdown. When you have markdown file, you can generate EPUB3 file with just one command: cheepub


You can install just use gem command:

$ gem install cheepub

If you use the gem in your project, add this line to your application's Gemfile:

gem 'cheepub'


You can add options --title and --author.

$ cheepub --title foo --author bar

With --latex option, you can generate PDF with LaTeX.

$ cheepub --title foo --author bar --latex

If you use front-matter section like Jekyll, you can execute without any options:

$ cheepub


  • -v, --version print version
  • --author AUTOR set author of the book
  • --title TITLE set title of the book
  • --config CONFIG set configuration file
  • --latex generate PDF (with LaTeX) file
  • --debug set debug mode
  • -o, --out OUTFILE set output filename
  • --[no-]titlepage add titlepage or not
  • --page-direction PAGE_DIRECTION set page direction (ltr or rtl)
  • --json output JSON AST and exit
  • -h, --help print help

Markdown extensions

Cheepub uses Kramdown and Gepub. So you can use Kramdown extensions and some other extensions from DenDenMarkdown.

  • newpage (separate files): ex. === or ------.
  • tate-chu-yoko (horizontal in vertical): ex. ^30^ or ^!?^.
  • footnote: ex. [^1] and [^1]: some notes about it.
  • ruby: ex. {some base text|some ruby text}


You can define configration with in front-matter or --config option.

Front Matter

Cheepub supports front-matter like Jekyll.

You can write author and title (and other configuration) at front of the markdown file.

title: The Last Leaf
author: O. Henry

In a little district west of Washington Square the streets have run crazy and broken themselves into small strips called "places." (...)

Configuration items

  • id: identifier
  • title: title of the book
  • author: author of the book
  • date: publishing date
  • lastModified: last modified date-time
  • pageDirection: ltr (horizontal) or rtl (vertical)
  • titlepage: add titlepage
  • colophone: add colophon page
  • colophone_before, colophone_after: some notes before/after colophon table
  • (LaTeX) latexCommand: command name of LaTeX (uplatex or lualatex)
  • (LaTeX) documentClass: document class and options. (ex. ["jlreq", "tate,book,a4paper,twocolumn,openany"])



  • update kramdown, gepub and rb_latex


  • support colophon_(before|after) in EPUB


  • support titlepage in LaTeX
  • support colophon in LaTeX


  • support Images in EPUB


  • support Markdown (pipe) table
    • cannot omit leading and trailing pipes (different with original kramdown)


  • support option --json


  • show backtrace when --debug mode
  • use rouge for EPUB instead of coderay
  • add more samples
  • add scripts conv_entity.rb


  • support option --debug
  • support documentClass for LaTeX in frontmatter


  • (experimental) generate PDF file with LaTeX


  • fix to generate valid epub file


  • support titlepage


  • fix writing-mode (pageDirection)
  • fix to generate nav.xhtml


  • add option --out


  • add option --title, --author, --config


  • First release.


After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at