Awkee / pandoc

Automatically exported from code.google.com/p/pandoc
GNU General Public License v2.0
0 stars 0 forks source link

Nested lists don't work in markdown #229

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a document with a nested list in markdown:
{{{
* a
  * should be nested 
* but it's not
}}}
2. Convert it to any format, I checked html and mediawiki

What is the expected output? What do you see instead?

The output is not a nested list. The nested element appears at the same 
level as the other elements.

What version of the product are you using? On what operating system?

1.4 on windows.

Original issue reported on code.google.com by paul.chi...@gmail.com on 1 Apr 2010 at 3:19

GoogleCodeExporter commented 9 years ago
Nested lists need to be indented four spaces or a tab. This is implied by the 
markdown 
syntax documentation, but not all implementations of markdown respect it.

Original comment by fiddloso...@gmail.com on 1 Apr 2010 at 10:46

GoogleCodeExporter commented 9 years ago
It is implied by the markdown syntax documentation? Where? John Gruber's
implementation works for any number of leading spaces, you can verify at:
http://daringfireball.net/projects/markdown/dingus

But good to know it works somehow. :)

Original comment by paul.chi...@gmail.com on 2 Apr 2010 at 3:40

GoogleCodeExporter commented 9 years ago
What's explicit in the markdown syntax description is that continuation 
paragraphs 
in a list item need to be indented four spaces (or eight if they're code 
blocks). It's 
reasonable to infer that all block-level elements in a list item need to be 
indented 
four spaces (at least in their first line - markdown allows you to be lazy 
about 
subsequent indents). Since a list is a block-level item, it's reasonable to 
assume the 
same rule applies there. And that is what many markup implementations, 
including 
pandoc, do.

It's true that Markdown.pl allows less than four-space indentation, but its 
treatment 
of nested lists is notoriously inconsistent, and it can't be used as any kind 
of a 
model.  Try this, for example:
% Markdown.pl
- one
  - two
    - three
<ul>
<li>one
<ul><li>two</li>
<li>three</li></ul></li>
</ul>

Here's you'd expect three levels of nesting, but you only get two. There are 
other 
examples on pandoc's googlecode wiki of crazy nested list behavior by 
Markdown.pl.

You might ask:  why not just consistently make any additional indentation start 
a 
sublist?  That would be easy to implement, and in fact that is how restructured 
text 
does it.  I think that one motivation for the different decision in markdown 
was to 
allow list markers to be right-aligned. Consider:

 9. nine
10. ten
11. eleven

Here the numbers don't line up in the same column on the left, but we want them 
to 
be considered a single-level list.

Anyway, this has been discussed at times on markdown-discuss, and no clear 
standard has emerged. Some people prefer a four-space rule; others a 
three-space 
rule; still others an any-additional-indent rule:
http://thread.gmane.org/gmane.text.markdown.general/1981/focus=1998

Original comment by fiddloso...@gmail.com on 2 Apr 2010 at 6:38

GoogleCodeExporter commented 9 years ago
Thank you for the thorough response. It does not surprise me that even Gruber's
implementation is totally inconsistent. That is what happens when you implement
something like markdown using a mess of interacting regex replacements, I 
suppose. :)
Sorry for the bad bug report - honestly, I just thought nested lists didn't 
work at
all. Your decision on how to handle things seems totally valid to me.

Awesome project, btw. 

Original comment by paul.chi...@gmail.com on 2 Apr 2010 at 11:54

GoogleCodeExporter commented 9 years ago
I know this is way old, but google brought me here for "markdown nested lists" 
:)

I think the issue might be caused by "list separation" -- if you put newlines 
between each level of indentation, it will trigger nesting.

Ex:

1. First level -- no indent
    2. Second level -- 1 indent (4 spaces, 3 spaces, tab, whatever)
    3. Second level, B -- 1 indent
        4. Third level -- 2 indents
    5. Second level, C -- 1 indent
6. First level -- no indent

Is not guaranteed to nest properly, whereas separating nesting levels:

1. First level -- no indent

    2. Second level -- 1 indent (4 spaces, 3 spaces, tab, whatever)
    3. Second level, B -- 1 indent

        4. Third level -- 2 indents

    5. Second level, C -- 1 indent

6. First level -- no indent

...should nest properly.

Original comment by jeremys....@gmail.com on 15 Mar 2013 at 6:25