Project

prawndown

0.0
No commit activity in last 3 years
No release in over 3 years
A tiny Ruby gem to render a subset of Markdown in PDF files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 5.0
~> 10.0
~> 0.16.1

Runtime

~> 2.0
 Project Readme

Prawndown

Build Status Coverage Status Read the Docs (version) Gem

A tiny Ruby gem to render a subset of Markdown in PDF files.

Prawn is a Ruby library to generate PDF files. It supports text formatting trough its own HTML-esque language, which has tags for different formatting options like bold, italic, strikethrough and links. Read more about the supported tags in the Prawn documentation.

Usage

Prawndown extends Prawn with the markdown method. It accepts the same options as Prawn::Document#text.

Use it to render Markdown in the document:

Prawn::Document.generate('markdown.pdf') do
  markdown '# Welcome to Prawndown!'
  markdown '**Important:** We _hope_ you enjoy your stay!', color: 'aaaaaa', leading: 10
end

If prefered, the parser can also be invoked directly:

Prawndown::Parser.new('_Welcome_ to **Prawndown**').to_prawn #=> '<i>Welcome</i> to <b>Prawndown</b>'

More thorough examples can be found under the examples folder. Run rake examples to generate the examples PDF.

Supported Markdown syntax

# Header 1
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6
_Italic_
*Italic*
__Bold__
**Bold**
~~Strikethrough~~
[Links](https://github.com/kaspermeyer/prawndown)

Note: Prawdown can't output the tags <sub>, <sup>, <font> and <color> as they lack native support in Markdown.

Installation

Add this line to your application's Gemfile:

gem 'prawndown'

And then execute:

$ bundle

Or install it yourself as:

$ gem install prawndown

Development

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.

Credits