We love markdown, cause it is friendly to edit. So we want everything to be markdown
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')
- gem
gem install html2markdown
- Rails Gemfile
gem 'html2markdown'
- prints to stdout
html2markdown [file]
- redirect to a new markdown file.
html2markdown index.html > index.md
Buy me a Kindle book 📖