Possible Markdown bug?

John Gruber gruber at fedora.net
Tue Mar 23 15:09:24 EST 2004

Craig Morgan <craig.morgan at sun.com> wrote on 03/23/04 at 9:11a:

> One small issue though regarding lists with embedded code blocks, which 
> seems to be generating illegal output ... test case attached at end of 
> message, note the code block in the second point.

Ouch. Definitely a bug.

> It seems that the correct <li> processing doesn't occur unless you trail 
> the code block with a blank line, but this has the undesired effect of 
> turning the following <li> item into a paragraph marked block.

I'm not sure what I'll end up doing here.

For sure, Markdown should never produce invalid markup like what's
coming out of your example. There are always going to be edge cases
where Markdown doesn't do exactly what you hope it does, but at the
very least, it should always generate valid XHTML.

One thing I discussed last week is that I'm not happy with
Markdown's current syntax for code blocks. The rules about colons
are just too complicated. So, soon, the rule is going to change so
that code blocks are simply indented blocks of text. No special
rules at all about preceding colons. If a block is indented by 4
spaces/1 tab, then it's a code block.

I'm not sure at this point what the rule will be about having blank
lines before and after a code block, however. No matter what,
though, the rules for blank lines before and/or after code blocks
will be clearly defined.

Perhaps I can work it out so that, in general, code blocks will
require a blank line before and after, but within a list item, you
will be able to use them without blank lines, so you can insert a
`<pre>` block within the `<li>` without having in-list `<p>` tags.

Thanks very much for the report.


More information about the Markdown-discuss mailing list