topher6345 / html2markdown

simple and flexible html to markdown converter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple html to Markdown ruby gem Code Climate

We love markdown, cause it is friendly to edit. So we want everything to be markdown

RSpec is our promise

p = HTMLPage.new :contents => '<strong>haha</strong>'
p.markdown.should == '**haha**'
p.contents = '<strong>hehe</strong>'
p.markdown!.should == '**hehe**'

# you can also define your own node parse
p.strong do |node,contents|
  "strong text : **#{contents}**"
end
p.markdown!.should be_include('strong text')

Installation

  • gem
gem install html2markdown
  • Rails Gemfile
gem 'html2markdown'

CLI usage

html2markdown [file]

The command line tool with print the markdown to stdout. You can then redirect to a file.

Ex.

html2markdown index.html > index.md

About

simple and flexible html to markdown converter

License:MIT License


Languages

Language:Ruby 100.0%