Showdown: HTML to Markdown (MD)

Created on 8 Sep 2018  路  7Comments  路  Source: showdownjs/showdown

Thanks for all the great work.

The repo describes showdown as "A bidirectional MD to HTML to MD converter written in Javascript ", but I can't find how to convert HTML to MD. Is this supported? I can't seem to find it in the documentation.

Thank you!

help wanted

Most helpful comment

Is there a way to use this in Node.js, as this seems to be using the window object?

All 7 comments

HTML to MD converter is a new feature, available only in master branch. The documentation hasn't been written yet.

To use it you can clone the master branch and use converter.makeMarkdown(htmlText)

@tivie After cloning a master brach I get a Module not found: Error: Can't resolve 'tls' in [...]/node_modules/tunnel-agent error. Any clues?

@maciej-kolodziejczak cd into the showdown directory and npm install. this cleared up those errors for me.

Okay I just ran into this, How exactly to I use this to convert html to markdown? npm link or something?

@tivie solved this in https://github.com/showdownjs/showdown/commit/e4b0e697243f2d8b0a604eb688d08938a0e7acbb (issue closed here https://github.com/showdownjs/showdown/issues/233#event-1958639417)

and this issue can probably also be closed.

Is there a way to use this in Node.js, as this seems to be using the window object?

I am late here but with an answer:

const converter = new showdown.Converter();
// To HTML from Markdown:
converter.makeHtml(__YOUR_MARKDOWN)
// To Markdown from HTML: 
converter.makeMarkdown(__YOUR_HTML)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

geudrik picture geudrik  路  7Comments

KirkMunro picture KirkMunro  路  6Comments

evanplaice picture evanplaice  路  3Comments

jendewalt picture jendewalt  路  4Comments

jonaskello picture jonaskello  路  4Comments