I’ve noticed that block level things are not really markdown friendly. Imagine the following segment (Yes, I am intending to output for twitter bootstrap):
<section id="loremipsum">
<div class="page-header">
# Heading 1 #
</div>
Lorem ipsum, blah blah blah, yada yada yada.
</section>
The expected output should be:
<section id="loremipsum">
<div class="page-header">
<h1>Heading 1</h1>
</div>
<p>Lorem ipsum, blah blah blah, yada yada yada.</p>
</section>
Instead, the produced output is closer to:
<p><section id="loremipsum"></p>
<div class="page-header">
# Heading 1 #
</div>
<p>Lorem ipsum, blah blah blah, yada yada yada.</section></p>
There are two problems here:
- As per suggested by Daring Fireball, Markdown should be smart enough to not put in un-wanted
tags around block level elements such as section tag.
- Heading 1 is not parsed as a heading, but instead left unparsed.
Both of these problems actually happens also in Dingus, the official parser, so I guess this is one of those “working as intended” kind of issue. That said, are there any markdown gurus out there that knows how to work around these problems?
Yep, that’s by design. According to Gruber:
I’m not aware of any sort of workaround for that, but I wouldn’t put myself at guru-level when it comes to Markdown.
Edit: You might want to check out PHP Markdown Extra if you’re working with PHP.