Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-standard behaviour for nested lists #55

Closed
stomar opened this issue Sep 14, 2012 · 6 comments
Closed

Non-standard behaviour for nested lists #55

stomar opened this issue Sep 14, 2012 · 6 comments

Comments

@stomar
Copy link
Contributor

stomar commented Sep 14, 2012

I converted the following markdown:

Is this a nested list (indent 1)?

* one
 * a
 * b
  * 1
  * 2
* two

Is this a nested list (indent 2)?

* one
  * a
  * b
    * 1
    * 2
* two

Is this a nested list (indent 3)?

* one
   * a
   * b
      * 1
      * 2
* two

Is this a nested list (indent 4)?

* one
    * a
    * b
        * 1
        * 2
* two

Expected(?) output:

  • one
    • a
    • b
      • 1
      • 2
  • two

I get a list with two nesting levels for cases 2 and 3,
where the list markers are indented by 2 or by 3 spaces from
level to level.

In the last case, strange things happen and the result is:

  • one * a * b * 1 * 2
  • two

I also converted using kramdown, pandoc, and the "original" Markdown.pl.
Though the behaviour differs widely for the cases 1 to 3 (!), they
all agree on the last one (with an indentation of 4 spaces) and
ouput a list with two nesting levels.

@distler
Copy link
Collaborator

distler commented Sep 14, 2012

This is the duplicate of bug #30.

Maruku doesn't recognize lists which are indented by 2 or 3 spaces relative to the "current" indentation.

@stomar
Copy link
Contributor Author

stomar commented Sep 14, 2012

No, it is not! The current behaviour is:

Maruku recognizes a new nesting level only for indentations of 2 or 3 spaces relative to the current indentation.

However, the widely agreed upon behaviour seems to be that 4 spaces of indentation do trigger a new nesting level. Pandoc even requires at least 4 spaces, other interpreters also allow 3 (Markdown.pl) or even only 2 spaces (kramdown).

@distler
Copy link
Collaborator

distler commented Sep 14, 2012

A nomenclatural problem. When we are processing a list

* This is level-1 (current indentation=2 spaces)

  So here we are at zero indentation, relative to the current indentation (of 2 spaces).

   * Here we started a new nested list at indentation=1 space (relative to the current indentation),
     for a total indentation of 3 spaces. Now, the current indentations is 5=2+3

     * So here is another level of nested list.

Bug #30 is precisely the reason why indented lists, with indentation (relative to the current indentation!) of 2 or 3 spaces are not recognized as such.

@stomar
Copy link
Contributor Author

stomar commented Sep 14, 2012

Of course...this makes perfect sense now.

@bhollis
Copy link
Owner

bhollis commented Sep 15, 2012

Thanks @distler, I'll close this as a dup.

@bhollis bhollis closed this as completed Sep 15, 2012
@tschaub
Copy link

tschaub commented Jun 25, 2013

Could you leave an example here of how to create a nested list? The example (case 2) above works only if the first list item is the only one with a nested list. This example doesn't work:

* one
  * a
  * b
* two
  * a
    * 1
    * 2
  * b
    * 1
    * 2

With maruku 0.6.0, the above markdown produces the following markup:

<ul>
<li>
<p>one</p>

<ul>
<li>a</li>

<li>b</li>
</ul>
</li>

<li>
<p>two * a * 1 * 2</p>
</li>
</ul>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants