Convert md to html, pdf…
Ruby CSS HTML Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
css
images
.gitignore
Gemfile
README.md
Thorfile
layout.html
render.sh

README.md

MD

Description

MD is a Thorfile to convert Markdown files to HTML and PDF versions.

The real power of MD Thorfile is that it uses a customizable HTML layout and CSS.

Features:

  • convert .md to .html with layout and CSS styling
  • convert .md to .pdf with layout and CSS styling

Installation

git clone git://github.com/synbioz/md.git
cd md
bundle install
thor md:setup # Copy default layout and css

thor install Thorfile

You can remove this clone since the Thorfile is installed system-wide.

Usage

On the command-line:

$ thor md:generate my_markdown_file.md # Generates "my_markdown_file.html"
$ thor md:generate my_markdown_file.md -f pdf # Generates "my_markdown_file.pdf"

Theme edition

When working on themes, you need to edit styles in ~/.config/md/themes/. To render the .pdf each time you update styles you can use a watch :

watch ./render.sh ~/.config/md/themes/**

Settings and customization

MD can be configured through an Mdfile placed in directory where you launch the command.

Mdfiles have two purposes:

  • Setting internal Markdown options through the markdown_option method,
  • Extending the default Markdown renderer by supplying a block to the renderer method.

For details about options and custom renderers, have a look at the Redcarpet docs.

Here is and example Mdfile:

markdown_options no_links: true,
                 no_images: true

renderer do
  def block_code(code, language)
    "#{language}: <pre>#{code}</pre>"
  end
end

Other

If you want to contribute or report bugs you should take a look at:

Problems, comments, and suggestions are welcome on the issue tracker.

Authors

  • Martin Catty (aka _fuse)
  • Nicolas Cavigneaux (aka Bounga)

Copyright (c) 2011 Synbioz, released under the MIT license.