Fenced code as only items in lists #10

Open
waylan opened this Issue Jan 25, 2012 · 0 comments

Projects

None yet

1 participant

@waylan
waylan commented Jan 25, 2012

When making a list in which the only contents of the list is fenced code blocks there seem to be a few minor bugs.

First this does not work (But maybe this one shouldn't?):

* ~~~
foo
~~~

You have to leave the first line blank.

* 
    ~~~
    foo
    ~~~

While that looks better (all lines of code block line up on the left), it is not immediately apparent. Perhaps a note in the documentation?

However, when nesting another list item things get weird. This does not work:

* 
    ~~~
    foo
    ~~~
    * 
        ~~~
        nested
        ~~~

Neither does this (blank line between items):

* 
    ~~~
    foo
    ~~~
                                         <- blank line here
    * 
        ~~~
        nested
        ~~~

To get it to work, one of the following needs to be done:

A second blank line has to be added to the nested item (but not the top item). Like this:

* 
    ~~~
    foo
    ~~~
                                         <- blank line here
    * 
                                         <- another blank line here
        ~~~
        nested
        ~~~

Or an extra blank line must be placed before each fenced code block but one is not needed between list items (although it can be added with no effect) . Like this:

* 
                                         <- blank line here
    ~~~
    foo
    ~~~
    * 
                                         <- another blank line here
        ~~~
        nested
        ~~~

While those both offer ways to get the desired output, the behavior seems inconsistent and is not going to be readily apparent to most.

As one final note, it seems that if the list items contain additional blocks (paragraphs) these issues go away. For example, the following example would explain why the last example above works:

* a paragraph
                                         <- blank line here
    ~~~
    foo
    ~~~
    * a nested paragraph
                                         <- another blank line here
        ~~~
        nested
        ~~~

But if this works:

* 
    ~~~
    foo
    ~~~

Then so should the nested variation of it with no additional blank lines IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment