Re: Multiline code block within a list
On Sun, Nov 6, 2011 at 10:11 PM, Ryan Chan ryanchan...@gmail.com wrote: Hello, How to correctly made multiline code block within a list, like.. * foo * bar * ``` Code 1 Code 2 Code 3 ``` * Another list item The above markup is not working, what I want is Code 1, Code 2 and Code 3 appear in different lines. Ryan, The backtick syntax is for code spans. If you want code blocks, then to should be using indented blocks. The block needs to be indented at least four spaces. Unfortunately, not all markdown implementations will recognize this (including markdown.pl). In fact, some implementations will will never allow *only* a code block in a list item. However, if you what to use the multiple block in a list item syntax that will work. Therefore, you list item will need some paragraph, followed by a blank line, followed by your code block. Of course, as additional blocks within a list item need to be indented four spaces, already, you will need to indent 8 spaces for a code block. So, something like this (spaces replaced by dots for illustrative purposes only): * foo * bar * A paragraph followed by a blank line Code 1 (8 spaces of indent) Code 2 Code 3 * Another list item If you don't want the extra paragraph, check http://babelmark.bobtfish.net/ for implementations that don't require it. -- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg ___ Markdown-Discuss mailing list Markdown-Discuss@six.pairlist.net http://six.pairlist.net/mailman/listinfo/markdown-discuss
Re: Multiline code block within a list
Actually this is one of the limitation that I went to reST...sad to hear the suitation is still the same.. On Mon, Nov 7, 2011 at 11:03 PM, Waylan Limberg way...@gmail.com wrote: On Sun, Nov 6, 2011 at 10:11 PM, Ryan Chan ryanchan...@gmail.com wrote: Hello, How to correctly made multiline code block within a list, like.. * foo * bar * ``` Code 1 Code 2 Code 3 ``` * Another list item The above markup is not working, what I want is Code 1, Code 2 and Code 3 appear in different lines. Ryan, The backtick syntax is for code spans. If you want code blocks, then to should be using indented blocks. The block needs to be indented at least four spaces. Unfortunately, not all markdown implementations will recognize this (including markdown.pl). In fact, some implementations will will never allow *only* a code block in a list item. However, if you what to use the multiple block in a list item syntax that will work. Therefore, you list item will need some paragraph, followed by a blank line, followed by your code block. Of course, as additional blocks within a list item need to be indented four spaces, already, you will need to indent 8 spaces for a code block. So, something like this (spaces replaced by dots for illustrative purposes only): * foo * bar * A paragraph followed by a blank line Code 1 (8 spaces of indent) Code 2 Code 3 * Another list item If you don't want the extra paragraph, check http://babelmark.bobtfish.net/ for implementations that don't require it. -- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg ___ Markdown-Discuss mailing list Markdown-Discuss@six.pairlist.net http://six.pairlist.net/mailman/listinfo/markdown-discuss ___ Markdown-Discuss mailing list Markdown-Discuss@six.pairlist.net http://six.pairlist.net/mailman/listinfo/markdown-discuss
Re: Multiline code block within a list
On 2011-11-08 01:08 +0800 Ryan Chan wrote: Actually this is one of the limitation that I went to reST...sad to hear the suitation is still the same.. Not with every implementation. You can do this easily with kramdown: * for * bar * Code 1 (8 spaces) Code 2 Code 3 * Another list item will produce ul lifor/li libar/li li precodeCode 1 Code 2 Code 3 /code/pre /li liAnother list item/li /ul The line with the `* ` (after `* bar`) is needed to tell kramdown that this is a list item and not just an asterisk. Best regards, Thomas ___ Markdown-Discuss mailing list Markdown-Discuss@six.pairlist.net http://six.pairlist.net/mailman/listinfo/markdown-discuss
Re: Multiline code block within a list
discount, PHP markdown, lunamark, pandoc2, and possibly others allow a code block as sole list item; you just need make sure that the text starts in the 8th column (where the list marker is the 1st column): * hi hi ul liprecodehi hi /code/pre/li /ul The ``` syntax for code blocks is a github addition, not supported by most other implementations. However, several implementations support fenced code blocks like this: code pandoc allows these as sole list items. * code +++ Thomas Leitner [Nov 07 11 21:55 ]: On 2011-11-08 01:08 +0800 Ryan Chan wrote: Actually this is one of the limitation that I went to reST...sad to hear the suitation is still the same.. ___ Markdown-Discuss mailing list Markdown-Discuss@six.pairlist.net http://six.pairlist.net/mailman/listinfo/markdown-discuss