Code blocks in blockquotes

bucephalus org bucephalus.org at gmail.com
Wed Jul 13 22:06:30 EDT 2011


According to John Gruber's syntax page
http://daringfireball.net/projects/markdown/syntax#blockquote
it is possible to nest a code block in a blockquote.
But Markdown.pl 1.0.1 shows some strange behavior in this respect.

Let me take the following text example (I use `***BEGIN**` and `***END***`
as delimiters for the examples):

***BEGIN***
This is a block of code in a blockquote:


> function hello = {

> begin

> begin

> begin

> return "Hello world";

> end

> end

> end

> };


Thank you for your attention.
***END***

A Markdown.pl conversion returns this:

***BEGIN***
<p>This is a block of code in a blockquote:</p>

<blockquote>
<pre><code>function hello = {
begin
begin
begin
return "Hello world";
end
end
end
};
</code></pre>
</blockquote>

<p>Thank you for your attention.</p>
***END***

But the `begin...end` blocks should be indented by two more spaces, each.
The result should have been this:

***BEGIN***
<p>This is a block of code in a blockquote:</p>
<blockquote>
<pre><code>function hello = {
begin
begin
begin
return &quot;Hello world&quot;;
end
end
end
};
</code></pre>
</blockquote>
<p>Thank you for your attention.</p>
***END***

This last result is in fact, what I obtain with Pandoc 1.8.1.1.


There is also a weakness in the syntax explanation for these blockquotes,
which left me puzzled for a while and caused some trouble in a program I am
working on. The definition says that `>` is the blockquote symbol, where in
fact, it is `> `, i.e. a greater-than plus a space.
For the nested code this means, that we have to start the line with `>` and
5 spaces, at least. 4 spaces are not sufficient, although this is what the
definition suggests.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20110714/f5c1b2d9/attachment.html>


More information about the Markdown-Discuss mailing list