Fenced code inside blockquote followed by fenced code #9

Open
waylan opened this Issue Jan 25, 2012 · 1 comment

2 participants

@waylan

Fenced code blocks inside a blockquote works fine until another fenced code block is included in the document anywhere after the blockquote.

For example:

> ~~~
foo
~~~

~~~
bar
~~~

results in:

<blockquote>
  <p>~~~
  foo</p>
</blockquote>

<pre><code><br /></code></pre>

<p>bar
~~~</p>

additionally:

> ~~~
foo
~~~

other stuff between the fenced code blocks

~~~
bar
~~~

does not help:

<blockquote>
  <p>~~~
  foo</p>
</blockquote>

<pre><code><br />other stuff between the fenced code blocks

</code></pre>

<p>bar
~~~</p>

If you remove all fenced code blocks after the blockquote, or have every line of the blockquote start with > then the problem goes away.

So this works fine:

> ~~~
> foo
> ~~~

~~~
bar
~~~

As does this:

> ~~~
foo
~~~

Paragraph at end of document

All examples above were tested on the Dingus with PHP Markdown Extra 1.2.5 .

@michelf
Owner

This is definitely a bug, but it's hard to fix given how the parser works currently.

To fix this we'd need to change the parsing model to a one-pass parser for block-level constructs. This is partially already done inside the HTML block hasher for a couple of constructs so it does not hash the content of code blocks, so it'd be a nice place to start the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment