showdownjs/showdown

Markdown inside HTML doesn't parse

SyntaxRules opened this issue · 5 comments

When there is markdown inside of html it doesn't seem to parse.

For example:

<div class="alert alert-info">
This is an **awesome** link to another site: [Internal to this website :)](/#/foo-bar).
</div>

renders as:

image

Using showdown v1.2.0.

Was this done by design? Or have we not had a need for it?

tivie commented

Actually, according to spec, elements inside html blocks should not be parsed by md engine. It is assumed anything inside an HTML block is already in HTML so it shouldn't need to be parsed.

The original markdown.pl, however, had a way of parsing HTML blocks by "marking" them with markdown="1".

Example:

# some markdown

blabla
<div>This is **not parsed**</div>
<div makrdown="1">This is **parsed**</div>

This was one of the project's original milestones. However, since no one has requested it yet I haven't thought of a way to implement it.

Do you think this is an important feature?

I would greatly enjoy this feature. My main use case is to be able to decorate markdown to look prettier. But I can understand why the original spec didn't make heavy provisions for it- markdown should be markdown, not markdown with html.

That being said github doesn't support this.

@tivie, you say "according to spec". Which spec is that? Is that CommonMark's?

tivie commented

@SyntaxRules Added the feature just now to develop branch. Mind taking a look?