showdownjs/showdown

markdown in html is jumping outside of the html element for custom elements

Open

#643 opened on Jan 22, 2019

View on GitHub
 (2 comments) (0 reactions) (1 assignee)JavaScript (1,640 forks)batch import
help wanted

Repository metrics

Stars
 (13,700 stars)
PR merge metrics
 (Avg merge 15h 21m) (3 merged PRs in 30d)

Description

<span markdown>
**test**

**test**
</span>

<div markdown>
**test**

**test**
</div>

<my-element markdown>
**test**

**test**
</my-element>

turns into

<p><span><strong>test</strong></span></p>
<p><strong>test</strong></p>
<div>
<p><strong>test</strong></p>
<p><strong>test</strong></p>
</div>
<p><span><my-element>test</strong></my-element></p>
<p><strong>test</strong></p>

So I'm assuming showdown is producing valid html, so it won't allow the block element inside the inline element.

But when I use a custom element and set it as a block element, I am still observing the same behaviour.

Is there a way to force showdown to treat it like a block element?

Contributor guide