diff --git a/CHANGELOG b/CHANGELOG index 8a82f70b..ddbbd981 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ === Edge +* Allow leading spaces on lists for backward compatibility with RedCloth 3.x. #89 + * Recognize deleted phrases when they start at the beginning of a line. #83 * Fix escaped tag when it has the class attribute and is in a
 tag. #95
diff --git a/ext/redcloth_scan/redcloth_scan.rl b/ext/redcloth_scan/redcloth_scan.rl
index 3226942f..7ebc9247 100644
--- a/ext/redcloth_scan/redcloth_scan.rl
+++ b/ext/redcloth_scan/redcloth_scan.rl
@@ -30,7 +30,7 @@
   ol = "#" %{nest++; list_type = "ol";};
   ul_start  = ( ul | ol )* ul A C :> " "+   ;
   ol_start  = ( ul | ol )* ol N A C :> " "+ ;
-  list_start  = ( ul_start | ol_start ) >{nest = 0;} ;
+  list_start  = " "* ( ul_start | ol_start ) >{nest = 0;} ;
   dt_start = "-" . " "+ ;
   dd_start = ":=" ;
   long_dd  = dd_start " "* LF %{ ADD_BLOCK(); ASET("type", "dd"); } any+ >A %{ TRANSFORM("text"); } :>> "=:" ;
diff --git a/test/lists.yml b/test/lists.yml
index 695783c1..24e98605 100644
--- a/test/lists.yml
+++ b/test/lists.yml
@@ -280,4 +280,22 @@ html: |-
   
\ No newline at end of file
+  
+---
+name: unordered list with leading spaces
+in: " * notice the leading space\n * RedCloth 3.0.4 used to accept it\n * Now we do too"
+html: |-
+  
+---
+name: ordered list with leading spaces
+in: " # notice the leading space\n # RedCloth 3.0.4 used to accept it\n # Now we do too"
+html: |-
+  
    +
  1. notice the leading space
  2. +
  3. RedCloth 3.0.4 used to accept it
  4. +
  5. Now we do too
  6. +
\ No newline at end of file