Home

Awesome

Summary

Transform html into markdown. Useful for example if you want to import html into your markdown based application.

Build Status Gem Version Code Climate Code Climate

Changelog

See Change Log

Requirements

  1. Nokogiri
  2. Ruby 2.0.0 or higher

Installation

Install the gem

[sudo] gem install reverse_markdown

or add it to your Gemfile

gem 'reverse_markdown'

Features

Usage

Ruby

You can convert html content as string or Nokogiri document:

input  = '<strong>feelings</strong>'
result = ReverseMarkdown.convert input
result.inspect # " **feelings** "

Commandline

It's also possible to convert html files to markdown using the binary:

$ reverse_markdown file.html > file.md
$ cat file.html | reverse_markdown > file.md

Configuration

The following options are available:

As options

Just pass your chosen configuration options in after the input. The given options will last for this operation only.

ReverseMarkdown.convert(input, unknown_tags: :raise, github_flavored: true)

Preconfigure

Or configure it block style on a initializer level. These configurations will last for all conversions until they are set to something different.

ReverseMarkdown.config do |config|
  config.unknown_tags     = :bypass
  config.github_flavored  = true
  config.tag_border  = ''
end

Related stuff

Thanks

Thanks to all contributors and all other helpers: