Tdue21 / markdownsharp

Automatically exported from code.google.com/p/markdownsharp
0 stars 0 forks source link

Can't have preformatted code immediately following a list (spec bug, not implementation bug) #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Sorry if this isn't the place to raise this sort of issue.

Hopefully I'm missing something here but the spec doesn't seem to allow 
preformatted code blocks to come directly after a list (because it reads 
the 4 spaces as a new paragraph within the last list item).

Markdown:

Here's an unordered list:

* asdf
* qwerty

    // Here's some performatted code:
    function() { }

Desired HTML:

<p>Here's an unordered list:</p>
<ul>
<li>asdf</li>
<li>qwerty</li>
</ul>
<pre><code>// Here's some performatted code:
function() { }</code></pre>

Actual HTML (produced by both MarkdownSharp and the Markdown Dingus):

<p>Here's an unordered list:</p>
<ul>
<li>asdf</li>
<li><p>qwerty</p>
<p>// Here's some performatted code:
function() { }</p></li>
</ul>

Original issue reported on code.google.com by matthew....@gmail.com on 16 Jan 2010 at 7:33

GoogleCodeExporter commented 9 years ago
This is indeed an ambiguity in the Markdown spec and not a code issue.

The workaround is to use HTML to seperate the two:

* asdf
* qwerty

<!-- nothing to see here -->

    // Here's some performatted code:
    function() { }

Here's the result of that in the Markdown Babelmark:

http://is.gd/6qDkB

I believe PHP Markdown Extra added a new code block syntax to get around this, 
like so:

code goes here

Original comment by wump...@gmail.com on 17 Jan 2010 at 7:07