What steps will reproduce the problem?
1. Create a document with a nested list in markdown:
{{{
- a
- should be nested
- but it's not
}}}
- 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.
Google Code Info:
Issue #: 229
Author: [email protected]
Created On: 2010-04-01T15:19:28.000Z
Closed On: 2010-04-01T22:46:16.000Z
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.
Google Code Info:
Author: [email protected]
Created On: 2010-04-01T22:46:16.000Z
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. :)
Google Code Info:
Author: [email protected]
Created On: 2010-04-02T03:40:34.000Z
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
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:
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
Google Code Info:
Author: [email protected]
Created On: 2010-04-02T06:38:51.000Z
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.
Google Code Info:
Author: [email protected]
Created On: 2010-04-02T11:54:33.000Z
I was just struggling with nested lists a bit and upon Googling, came across this resolved issue and the comment I liked above from @jgm was the answer for me.
I think https://guides.github.com/features/mastering-markdown/ should be updated to say indentation should be 4 spaces or a tab.
Also, the examples for nested lists use 2 spaces in the Lists example, but the Lists section on the page shows 3 spaces. These should both probably use 4 spaces to further clarify.
Thanks!
-Martin
@mhbrown - yes, absolutely. The advice in the "mastering markdown" page you link to is very bad. The only safe advice that will work reliably across all Markdown implementations is to use a 4-space indent. A 2-space indent
See http://johnmacfarlane.net/babelmark2/?normalize=1&text=+-+a%0A+++-+b%0A+++++-+c%0A+++++++-+d%0A for an illustration.
The situation is even worse for ordered lists: http://johnmacfarlane.net/babelmark2/?normalize=1&text=+1.+a%0A+++2.+b%0A+++++3.+c%0A+++++++4.+d%0A. Only one implementation (not the one GitHub uses) consistently honors a 2-space indent.
Please give feedback to GitHub to change their misleading guide.
Most helpful comment
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.
Google Code Info:
Author: [email protected]
Created On: 2010-04-01T22:46:16.000Z