[kramdown-users] idea: delimited code in deeper structures

Thomas Leitner t_leitner at gmx.at
Wed Aug 4 02:28:48 EDT 2010


On 2010-07-22 09:38 -0700 Matt Neuburg wrote:
> I really like the ability to eliminate the four spaces indentation at
> the start of a code block by delimiting it with tildes. I'm wondering
> how hard it would be to extend this to deeper structures:
> 
> * First item of a list.
> 
>     ~~~~
>     Code example within the list.
>     ~~~~
> 
> * Second item of the list.

This is already supported! All block level elements can be used where a
block level element is expected. Therefore fenced code blocks can
appear in list items and blockquotes. You need to make sure that the
tildes start at the *current* left margin, they may *not* be indented
up to three spaces!

This is also why your example above won't work: The left margin for the
block level elements of the first list item is at column two. Since you
indented the tildes with two additional spaces, the fenced code block
is not recognized. Just remove the two leading spaces from the code
block and the tildes or use two additional spaces after the asterisk on
the list item line.

-- Thomas


More information about the kramdown-users mailing list