trentm/python-markdown2

Cannot properly render markdown in <div> or <p> tag

hsiangjenli opened this issue · 2 comments

I'm trying to put list, hyperlink, bold etc… between div tag, but it cannot properly render. Instead, treat it as normal text.

<div>

1. 1
1. BBB

</div>

Expected

<div>
  <ol>
    <li>AAA</li>
    <li>BBB</li>
  </ol>
</div>

Actual

<div>

1. AAA
1. BBB

</div>

This isn't a bug, this is something covered by the markdown-in-html extra. You need to enable this extra and then modify your <div> blocks slightly to include a markdown="1" attribute like so:

<div markdown="1">
1. AAA
2. BBB
</div>

It doesn't really matter what you set the value of the markdown= attribute to be, if the HTML tag has that attribute it will be processed as markdown

Thanks for taking a better look at this @Crozzers