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

Nested lists require 4 spaces of indent #3

Closed
waylan opened this Issue Apr 21, 2011 · 5 comments

Comments

Projects
None yet
3 participants
@waylan
Copy link
Member

waylan commented Apr 21, 2011

This issue is copied from Ticket 64 of our old bug tracker. It has been copied as-is:

Nested lists do not nest. I've tried:

* Item 1
  * Item A
  * Item B

I get a flat list.

Tried it here too:
http://babelmark.bobtfish.net/?markdown=*+Item+1%0D%0A++*+Item+A%0D%0A++*+Item+B&compare=on&src=4&dest=4

Comments

By Waylan 7/1/10

Actually nested lists work fine when you indent with 4 spaces (I changed the title to better fit the actual situation). I realize that the Perl implementation works with 2 spaces of indent, but the fact is the syntax rules make no mention of any nested lists whatsoever and all other types of blocks require 4 spaces so Python-Markdown is consistent and requires 4 spaces for all types of nests content in lists (at least the first line of each block must be nested 4 spaces).

Unless someone can convince me otherwise, I'm considering this a bug in the perl implementation (and all other implementations that have copied its behavior). This will be marked wontfix in a few days. Please take any discussions on the matter to the mailing list.

@waylan

This comment has been minimized.

Copy link
Member Author

waylan commented Jul 21, 2011

If you wan this you can do:

markdown.markdown(text, tab_length=2)

This will work just fine. Of course, you will also need to use 2 spaces for indenting code blocks and everything else. The thing is, the entire parser relies on this variable being set. We can't use one figure some places and other other places.

I'm closing this WONTFIX.

@waylan waylan closed this Jul 21, 2011

@nidico

This comment has been minimized.

Copy link

nidico commented Nov 17, 2014

This is very unfortunate. As written in this issue, 2 spaces are assumed to be the standard for nested lists (e.g. github does that; but the markdown syntax description leaves this open), 4 spaces for code blocks.

As #364 shows, this confuses many people. I didn't expect that all - I thought nested lists were simply not working, or I needed an empty line between indentation levels or I couldn't mix * and - symbols or something. Unnecessary confusion.

If it's not possible to do this in the parser, I consider this a parser bug.

As a short term workaround, the tab_length=2 is okay, but I think this should be the default.

@waylan

This comment has been minimized.

Copy link
Member Author

waylan commented Nov 18, 2014

Python-Markdown's behavior is _NOT_ a bug (and not up for debate). As I clearly state in #364:

The syntax rules clearly state:

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab.

To me, any behavior which differs from that is a bug.

The word "must" leaves no room for interpretation. To require anything less that 4 spaces _is a bug_. In fact, for years now, this position has been stated in our documentation.

Yes, this means that almost all other implementations contain a bug. However, I am not going to copy that bug into my implementation. It is a bug. Why would I do that? So yes, it is unfortunate... that all the other implementations implement this bug. Perhaps they should stop (for the record, I know why they don't but that is a different discussion).

And while GitHub may be popular, their Markdown implementation is probably one of the farthest from the rules IMO. In the past when I reported a difference between the standard and their behavior, their response was that they didn't care what Markdown does, they were going to do their own thing anyway. So, please don't ever suggest that I should follow GitHub's lead in how to interpret Markdown text. If anything, I would suggest that GitHub stop calling their implementation Markdown.

But, hey, everyone is entitled to their own opinion. If you disagree with me, go create your own extension which implements lists as you want them to work. We provide the API so you can do anything you want. In fact, the Sane Lists extension provides an alternative list parser (which addresses a different issue with lists). No reason why one couldn't exist which implements this bug everyone keeps requesting.

@nidico

This comment has been minimized.

Copy link

nidico commented Nov 18, 2014

Thanks for the clarifications and sorry for the annoyance!

@radude

This comment has been minimized.

Copy link

radude commented Feb 9, 2018

Made an extension to fix this wontfix.
https://github.com/radude/mdx_truly_sane_lists

Shame on me for this shameless self-promotion

@lydell lydell referenced this issue Nov 6, 2018

Closed

Prettier support #751

sohrab- added a commit to sohrab-/concourse-tutorial that referenced this issue Jan 29, 2019

sohrab- added a commit to sohrab-/concourse-tutorial that referenced this issue Jan 29, 2019

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