showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.06k stars 1.57k forks source link

Support from Markdown+HTML to Markdown #657

Open ythecombinator opened 5 years ago

ythecombinator commented 5 years ago

Hey, thanks for the amazing lib!

I was wondering if it's possible to have quite opposite of this https://github.com/showdownjs/showdown/issues/273.

If I run converter.makeMarkdown(html) on the following html:

<h1>This is valid markdown</h1>

<img alt="And so are image tags" src="./img.png"/>

I need, for example, to prevent images from being parsed to markdown, resulting in:

# This is valid markdown

<img alt="And so are image tags" src="./img.png"/>

I admit I couldn't find related issues/docs. Is that possible? If so, would the result be parseable back to html using converter.makeHtml(md)?

tivie commented 5 years ago

You can achieve this with an extension, although currently makeMarkdown is still an experimental feature.