Nested lists don't work in markdown #137
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: fiddloso...@gmail.com
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: paul.chi...@gmail.com
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
- one
- two
- three
- one
- two
- three
- one
- three
- two
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:
- nine
- ten
- 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
Google Code Info:
Author: fiddloso...@gmail.com
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: paul.chi...@gmail.com
Created On: 2010-04-02T11:54:33.000Z
What steps will reproduce the problem?
1. Create a document with a nested list in markdown:
{{{
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: paul.chi...@gmail.com
Created On: 2010-04-01T15:19:28.000Z
Closed On: 2010-04-01T22:46:16.000Z