Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fenced code inside blockquote followed by fenced code #9

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

Fenced code inside blockquote followed by fenced code #9

waylan opened this issue Jan 25, 2012 · 1 comment

Comments

@waylan
Copy link

waylan commented Jan 25, 2012

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
Copy link
Owner

michelf commented Jan 25, 2012

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
Projects
None yet
Development

No branches or pull requests

2 participants