Giter Site home page Giter Site logo

prawndown's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.