Awesome
Workflow - Quick prototyping script for creating rich html and pdfs from markdown documents
Workflow is a small script for generating nice-looking web pages and pdf documents from markdown using a CSS switcher. This means that creating a webpage or pdf is simply a matter of writing some content in markdown and choosing a CSS template, which can drastically reduce the amount of time required to put documentation online.
Requirements
- ruby and the kramdown gem
- wkhtmltopdf
- rinku for autolinking
Usage
Given a plain markdown document, Workflow by default will create an html file with an embedded switcher, allowing you to cycle interactively through a list of CSS templates to see which one works best with your document. You can try this by cloning or downloading the project and running the following command on this readme file from within the project directory:
/.workflow.rb README.md
Once you have decided on a CSS template, just run workflow.rb again with the -s
option to generate a permanent file with your chosen CSS included:
./workflow.rb -s siimple README.md
Use the -p
option to create a PDF using your selected CSS template:
./workflow.rb -ps siimple README.md
You can view an online demo or download a pdf which is the result of running the above commands.
Code highlighting
Syntax highlighting for code blocks uses pygments-css via the Pygments CSS Stylesheets Previewer.
Use the -c
option to turn on syntax highlighting.
./workflow.rb -cps siimple README.md
To use a different highlighting theme than the default, specify a Pygments CSS style using the -C
option. For example, to use the Solarized Light theme:
./workflow.rb -cps siimple -C solarized-light README.md
To see all the available syntax highlighting themes, take a look at the online style switcher for Pygments CSS, with sample code in a variety of programming languages.
Options
-c
,--code-highlighting
: Use code syntax highlighting-C
,--code-style [STYLE]
: Specify style to use for syntax highlighting-f
,--fixes
: Fixes some common display problems with pdfs-h
,--header TEXT
: Add arbitrary header text to top of each pdf page-o
,--output NAME
: Basename of output file (by default same as input file)-p
,--pdf
: Create pdf instead of html-n
,--numbers
: Add a footer with page numbers-s
,--stylesheet NAME
: Specify name of stylesheet to use instead of CSS switcher
Related projects
- dropin-minimal-css, on which this script is based
- asciidoctor-skins, for a similar idea but with asciidoctor
License
MIT.