(Source: gist.github.com/clintel/1155906)
For discussion, see issue #1. Thanks to Thomas Leitner for clearing up the syntax.
How it works
The gist is that the indentation for the code block in lists is determined by the column number of the first non-space character after the list item marker.
Examples (edit: I replaced the leading spaces with dots e.g. ·
so it looks correct):
Bulleted List
*·some text => use 2 spaces indentation
*···some text => use 4 spaces indentation
Numbered List
1.·some text => use 3 spaces indentation
==> If you line up the fenced code block with the “natural” list indentation, it will work.
Now do this:
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
I’m going to include a fenced code block as part of this bullet:
Code
More Code
Like this:
printf("Hello, World!");
I’m going to include a fenced code block as part of this bullet:
Code
More Code
Like this:
printf("Hello, World!");