5

I'm using Maruku, to convert from Markdown (superset) to HTML, do you know how can I do to convert from HTML to Markdown?

Claudio Acciaresi
  • 31,951
  • 5
  • 33
  • 43
  • Use XSLT: http://stackoverflow.com/questions/59557/html-to-markdown-with-java – Josh Lee Nov 17 '09 at 20:50
  • I haven't tried it, and it is likely not as good as one of the dedicated options, but there's also the kramdown gem. It can take HTML as an input, and it can generate markdown as an output (as well as the reverse). – iconoclast Jan 13 '16 at 19:39

2 Answers2

11

Google found a ruby script called reverse_markdown. It seems to do what you are looking for.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
mtyaka
  • 8,670
  • 1
  • 38
  • 40
  • I was looking for a native ruby solution to the problem, thanks a lot anyway – Claudio Acciaresi Nov 17 '09 at 21:03
  • 5
    What do you mean by "native ruby"? As far as I can tell the above script is 100% ruby. – mtyaka Nov 17 '09 at 21:43
  • 1
    That script falls apart horribly on some fairly basic HTML I fed it. Fed the same HTML to [html2text](https://github.com/aaronsw/html2text) and it worked perfectly. – Steve Nov 20 '11 at 09:46
1

try html2markdown http://rubygems.org/gems/html2markdown

And now, I found http://markitdown.medusis.com/ is very useful and quick.

alswl
  • 1,265
  • 11
  • 11