mistune icon indicating copy to clipboard operation
mistune copied to clipboard

Parsing Markdown blocks inside HTML blocks, and inline Markdown inside nested HTML elements

Open nottrobin opened this issue 5 years ago • 0 comments

I'm trying to parse HTML similar to the following (in Mistune 0.8.4):

<details>
<summary>`some code`</summary>

**Something**

---

Some paragraph
</details>

But I can't find a way to make it create paragraphs or the HR, or parse the <code> block inside the <summary> tag:

In [1]: from mistune import Markdown

In [2]: Markdown(parse_block_html=True, parse_inline_html=True)("<details>\n<summary>`some code`</summary>\n\n**Something**\n\n---\n\nSome paragraph\n</details>")
Out[2]: '<details>\n<summary>`some code`</summary>\n\n<strong>Something</strong>\n\n---\n\nSome paragraph</details>'

Is there any way to get Mistune to parse block markdown inside block HTML elements? Or to get it to parse <code> blocks inside inline HTML elements that are nested inside block HTML elements?

nottrobin avatar Jun 29 '20 15:06 nottrobin