Closed henrahmagix closed 2 years ago
Thanks for your great library btw! I really love using it to make my own admin interface for a Jekyll site =) Anyway onto the issue:
It's mentioned in https://github.com/showdownjs/showdown/issues/588#issuecomment-425278067 that
Showdown differentiates between block and inline HTML elements. Block elements are encoded as soon as possible while inline elements are "left alone".
<details> is a block-level element (at least in latest Safari and Chrome), so it's not allowed inside <p>, but Showdown still wraps it in <p>.
<details>
<p>
The following example shows how the browsers "fix" the structure of the HTML emitted by Showdown:
const s = new showdown.Converter(); const html = s.makeHtml('<details></details>'); // <p><details></details></p> const div = document.createElement('div'); div.innerHTML = html; const browserHTML = div.innerHTML; // <p></p><details></details><p></p> // can't use browserHTML :'(
Thanks for your great library btw! I really love using it to make my own admin interface for a Jekyll site =) Anyway onto the issue:
It's mentioned in https://github.com/showdownjs/showdown/issues/588#issuecomment-425278067 that
<details>
is a block-level element (at least in latest Safari and Chrome), so it's not allowed inside<p>
, but Showdown still wraps it in<p>
.The following example shows how the browsers "fix" the structure of the HTML emitted by Showdown: