markover

Build Status

Description

markover is a utility for converting markup (markdown, textile, ...) to PDF files. Useful for reports, documentations and such things.

It's a fork of the dead gimli gem.

It supports ...

  • ... multiple markup styles
  • ... syntax highlighting
  • ... covers
  • ... CSS
  • ... images
  • ... table of contents
  • and more.

It works by converting the markup to pdf using wkhtmltopdf The markup is converted to html using github/markup

Markup

Markup files may be written in any format supported by GitHub-Markup (except roff).

Images

Images can be included by absolute url on your hard drive or a absolute url on the Internet. You can also refer to an image relative from the markup file. Example in markdown.

![test.jpg](/tmp/test.jpg)
![wiki.png](http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png)
![test.jpg](../images/test.jpg)

Installation

The best way to install markoverf is with RubyGems:

$ gem install markover

You can also install from source:

$ git clone https://github.com/phortx/markover.git
$ cd markover
$ bundle
$ rake install

Usage

The standard way to run markover is to go to a folder with markup files and running markover

Own CSS

To apply some style to the pdf or override the standard style add a css file in the directory named markover.css or use the -s flag to point out another css file.

Output file

Standard behavior is for md2pd to output the files in the current directory. To override this use the -o flag to point out another output directory. markover tries to create it if it doesn't exist.

Jekyll

markover also plays nice with Jekyll style markup files. You can pass markover the -y flag to have it remove Jekyll's YAML front matter from the top of your markup files. Allowing you to use markover & Jekyll together on your Blog/Resume/Catalogue to create nicely formatted versions for online and offline viewing.

wkhtmlpdf

To pass parameters directly to wkhtmltopdf, use the -w flag. eg.

$ markover -f test.md -w '--toc --footer-right "[page]/[toPage]"'

This gives a pdf with a table of contents and page numbers in the footer.

See the man page for wkhtmltopdf for all possible parameters.

Everything else

Run markover -h for a full list of options available.

Syntax highlighting

In page files you can get automatic syntax highlighting for a wide range of languages by using the following syntax:


```ruby
  def foo
    puts 'bar'
  end
```

The block must start with three backticks (as the first characters on the line). After that comes the name of the language that is contained by the block. The language must be one of the short name lexer strings supported by coderay. See the list of lexers for valid options.

If the block contents are indented two spaces or one tab, then that whitespace will be ignored (this makes the blocks easier to read in plaintext).

The block must end with three backticks as the first characters on a line.

The syntax highlightning is powered by coderay and is using a github theme.