pegdown icon indicating copy to clipboard operation
pegdown copied to clipboard

Indented fenced code blocks containing blank lines do not render properly.

Open djneades opened this issue 12 years ago • 3 comments

When a fenced code block is indented (because it is part of a bulleted list, for example), it will not render correctly if it contains one or more blank lines.

The following Markdown shows the problem:

~~~
Unindented fenced blocks work fine with blank lines, like the following:

This block renders without problems.
~~~

*   First paragraph of a bullet point.

    ~~~
Indented fenced blocks break if they contain blank lines, like this one:

See? This block was not correctly rendered.
~~~

    Another paragraph of a bullet point.

The second fenced block renders fine if the blank line is removed.

djneades avatar Apr 17 '13 16:04 djneades

Thanks, I'll check it out...

sirthias avatar Apr 18 '13 07:04 sirthias

Thank you, much appreciated.

djneades avatar Apr 18 '13 15:04 djneades

While trying to work around this issue, I noticed that a similar thing happens if I try to have an indented block HTML element (e.g. <pre><code>...</code></pre>) in a bullet list. This works, but again, only if there is no blank line within the block.

Now, strictly speaking, indented block HTML in a bullet list isn’t valid Markdown (Gruber: ‘the start and end tags of the [HTML] block should not be indented with tabs or spaces’), but since indented blocks almost work in pegdown, and since they are useful, it would be nice if pegdown fully supported them.

As a work-around for my content, I have reverted to using HTML ul/ol elements (rather than Markdown syntax) for bullet lists that contain list items with embedded code blocks.

djneades avatar Apr 18 '13 23:04 djneades