• Stars
    star
    538
  • Rank 82,538 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 13 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Utility for converting markup files to pdf files

gimli – utility for converting markup to pdf

Description

Gimli is a utility for converting markup to pdf files. Useful for reports and such things. It’s a developed version of textile2pdf to support multiple markup styles and to get syntax highlighting.

It’s inspired by the markup convertion in gollum. The markup code is adapted from gollum. 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 textile.

!/tmp/test.jpg!
!http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png!
!../images/test.jpg!

Installation

The best way to install Gimli is with RubyGems:

$ [sudo] gem install gimli

You can install from source:

$ cd gimli/
$ bundle
$ rake install

On Windows

If you want to use gimli on windows you will have to make the following actions.

  • Install wkhtmltopdf separatly on your OS. Find the package here.

Make sure that the path to the wkhtmltopdf.exe binary is in your $PATH environement variable. Also make sure that it's palced before the path to the ruby directory.

  • Install the which command of the GnuWin32 on your OS. Find the package here. This command allow gimli to locate the correct binary or wkhtmltopdf on your hard drive to perform the html->PDF conversion.

Make sure that the path to which.exe the binary is in your $PATH environement variable

Running

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

$ gimli

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

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

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

Gimli can add a cover to your document based on another markdown file. To do this use the -cover flag. eg.

$ gimli -f doc-file.md -cover cover-file.md

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

$ gimli -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.

Run gimli -h for a full list of options available

Gimli Docker Container

There is a Docker container to use for converting files using gimli without installing gimli to your computer, you can see more about it at https://registry.hub.docker.com/u/walle/gimli/

Running the image

$ docker run -v <host_dir>:<container_dir> walle/gimli -f <container_dir>/my-file.md -o <container_dir>

Where <host_dir> is the directory with the files you want to convert and <container_dir> is the directory in the image where the files will be put. This will write the pdf files to the same directory as where your source files is. If you want to make a new directory for the pdfs you can call the image like this:

$ docker run -v <host_dir>:<container_dir> walle/gimli -f <container_dir>/my-file.md -o <container_dir>/pdfs

This will put the pdfs in a folder named pdfs in your <host_dir>.

A real example
$ docker run -v /home/walle/gimlidocuments:/tmp/gimli walle/gimli -f /tmp/gimli/my-file.md -o /tmp/gimli

This will generate a pdf from the file in /home/walle/gimlidocuments/my-file.md in the /home/walle/gimlidocuments directory.

Arguments

All arguments you supply to running the image will end up in gimli, so for an example you could supply the -s flag to use a custom stylesheet. But the stylesheet must be in <host_dir> to be readable by gimli.

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.

More Repositories

1

wiki

Command line tool to fetch summaries from MediaWiki wikis, like Wikipedia
Go
287
star
2

gas

Manage your git author accounts
Ruby
104
star
3

raycaster

A quick port of "A first-person engine in 265 lines" from JavaScript to Java using the libGDX framework.
Java
71
star
4

lll

Line length linter
Go
65
star
5

targz

Library for packaging/extracting folders in tar.gz archives.
Go
11
star
6

cfg

Simple read/write and commentable config files for go
Go
11
star
7

markdowneditor

Simple notepad like webapp/bookmarklet in three flavors. Used to scribble down notes in markdown and preview them.
11
star
8

textile2pdf

Simple utillity to convert textile to pdf files.
Ruby
7
star
9

postnummer

Ruby
7
star
10

git-cdd

Commit Driven Development in git
Shell
5
star
11

postnummer_api

Simple JSON API that gets data from https://github.com/walle/postnummer
Ruby
5
star
12

mdpdf

A small utility for converting markdown to PDF.
C
4
star
13

pgm

Dead simple tool for running migrations for postgresql
Go
4
star
14

guard-gimli

Guard gem for gimli
Ruby
4
star
15

one-word-story-game

Game where the github community creates a story one word at a time.
3
star
16

fval

Simple go library for validating file and directory existence
Go
3
star
17

cStack

A simple generic stack implementation in c
C
3
star
18

fabric-ui

Simple jquery plugin with ui for fabric.
JavaScript
3
star
19

mouseTracker

Mouse tracking image generator.
Java
2
star
20

gas_stats

Keep track of your gas usage
Ruby
2
star
21

jsular

Port of rubular.com for javascript
Ruby
2
star
22

pi2ascii

Quick test for converting the decimals of PI to ascii.
Ruby
2
star
23

dotfilesOld

My commonly used dotfiles
Shell
2
star
24

combine

Library and binary for concatenating files using a template that includes other files
Go
2
star
25

gimli-examples

A collection of example pages built with gimli
2
star
26

gypcms

A php cms that uses git, yaml and php as main components
PHP
2
star
27

lights-out

Simple game built with electron
JavaScript
1
star
28

md5calc

Old project in c# originally for windows, but compiles in monodevelop too, to calculate md5 hashes. Have functionality to save a list of words+hashes.
C#
1
star
29

todos

Ruby
1
star
30

postnummer_info

Information page for postnummer.info
JavaScript
1
star
31

dotvim

Vim setup
Vim Script
1
star
32

exoudus

Simple space shooter game
C++
1
star
33

tyda-api

App for getting JSON data from tyda.se. Outputs JSON on stdout as default.
Go
1
star
34

dotfiles

Vim Script
1
star
35

pc

Simple password generator
Ruby
1
star
36

pvm

Shell
1
star
37

htmlnote

Simple slideshow app in rails 3.1. Built to test out the new features in 3.1.
Ruby
1
star
38

passgen

Old project in c# originally for windows, but compiles in monodevelop too, to generate passwords based on two values.
C#
1
star
39

myleveleditor

My attempt to make a plugin based level editor. Project died out long ago.
C#
1
star
40

gobenchui-gui

A desktop application for gobenchui
JavaScript
1
star
41

phpSourceFormatter

Old project for formatting php code. Don't even remember how far I got.
PHP
1
star
42

tyda.pl

Simple command line tool to search tyda.se
Perl
1
star
43

minesweeper

Two minesweeper implementations using common library.
C++
1
star
44

ape

Simple project management application with wiki, tickets, milestones and scm integration.
Ruby
1
star