bhollis / maruku

A pure-Ruby Markdown-superset interpreter (Official Repo).
MIT License
502 stars 80 forks source link

Marku doesn't recognize lists with two or three spaces before the list mark #30

Closed weakish closed 11 years ago

weakish commented 13 years ago

Quoted from markdown syntax:

List markers typically start at the left margin, but may be indented by up to three spaces.

But Marku only recognizes lists indented by zero or one space.

Example:

This is a list:

* a list

This is a list, too:

 * another list

But this is also a list:

  * yet another list

And this:

   * still a list
stomar commented 12 years ago

Confirmed for the current version of maruku. Reason lies in `lib/maruku/input/type-detection.rb' (line 60ff.):

# Something is wrong with how we parse lists! :-(
#return :ulist    if l =~ /^[ ]{0,3}([\*\-\+])\s+.*\w+/
#return :olist    if l =~ /^[ ]{0,3}\d+\..*\w+/
return :ulist    if l =~ /^[ ]{0,1}([\*\-\+])\s+.*/
return :olist    if l =~ /^[ ]{0,1}\d+\.\s+.*/

The regexes accept only one or two leading spaces.

PS. Simply changing {0,1} to {0,3} or using the commented out lines breaks some test cases.

PPS. kramdown, pandoc, and the "original" Markdown.pl all work as expected.

tschaub commented 11 years ago

Is it possible with maruki 0.6.0 to create a nested list? I left a comment on #55 with the syntax I'm trying. Can't seem to find the magic indentation to create proper nested lists.