vmg / redcarpet

The safe Markdown parser, reloaded.
MIT License
4.99k stars 526 forks source link

Nested lists treated as code blocks #230

Open mitya57 opened 11 years ago

mitya57 commented 11 years ago

Hi,

According to the Markdown syntax rules:

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

That rule remains true when one of the paragraphs is a list itself, like here:

1. first item

    - nested list item 1
    - nested list item 2

2. second item

The code above should result in a bullet list contained inside a numbered list item.

According to Babelmark 2, RedCarpet is the only parser that treats this as a code block — this behaviour is wrong and incompatible with other Markdown implementations, such as PHP Markdown and Python-Markdown.

This also affects the GitHub flavored Markdown.

mattr- commented 11 years ago

You can workaround for now this by removing the blank lines from between the list items.

On Wed, Apr 24, 2013 at 10:19 AM, Dmitry Shachnev notifications@github.comwrote:

Hi,

According to the Markdown syntax ruleshttp://daringfireball.net/projects/markdown/syntax#list :

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

That rule remains true when one of the paragraphs is a list itself, like here:

  1. first item
    • nested list item 1
    • nested list item 2
  2. second item

The code above should result in a bullet list contained inside a numbered list item.

According to Babelmark 2, RedCarpet is the only parserhttp://johnmacfarlane.net/babelmark2/?text=1.+first+item%0A%0A++++-+nested+list+item+1%0A++++-+nested+list+item+2%0A%0A2.+second+itemthat treats this as a code block — this behaviour is wrong and incompatible with other Markdown implementations, such as PHP Markdown and Python-Markdown.

This also affects the GitHub flavored Markdown.

— Reply to this email directly or view it on GitHubhttps://github.com/vmg/redcarpet/issues/230 .

mitya57 commented 11 years ago

Thanks for the fast response! I will use that workaround for now.

marano commented 11 years ago

would love to see this fixed <3

calexicoz commented 11 years ago

Would love to this fixed as well :)

ma11hew28 commented 10 years ago

This bug is worse than having a dog shit on your carpet.

abinoda commented 10 years ago

Is this going to get fixed?

mattr- commented 10 years ago

Nope. Never. :wink:

All joking aside, we can't say when this will be fixed. If this issue is something that important to you, perhaps you'd consider fixing it yourself and sending a pull request?

abinoda commented 10 years ago

I wouldn't mind taking a stab at it.

In my particular case, I ended up using your workaround with one caveat. While the workaround you pointed out earlier fixed the rendering in RedCarpet, it broke the rendering in my desktop markdown editor (LightPaper). However I downloaded http://mouapp.com which was able to correctly render lists without a preceding newline.

With all that said, I'm wrestling another problem right now... I'll file an issue if necessary.

zachhale commented 10 years ago

Agreed, this is very frustrating!

zyberspace commented 10 years ago

Wow, i came across this issue yesterday in my GitLab-environment and now i found out that this bug exists since April 2013? :D Hope this will get fixed soon, but thx to @mitya57 for pointing out that RedCarpet is the only parser that has this bug.

Envek commented 10 years ago

Adding :disable_indented_code_blocks option doesn't help, nested list is still broken (but not in block).

Also workaround mentioned above doesn't help if there is more than one nested list.

Example:

Header
------

 1. One thing

    More descriptive

    Also
     * One
     * Two

    Moreover:
     * One
     * Two

List after "Moreover" will be broken: it will be rendered as is (with stars) in the same <P> tag with "Moreover".

And yes, this is very annoying bug.