diff --git a/lib/index.coffee b/lib/index.coffee index 173e1ea..5910602 100644 --- a/lib/index.coffee +++ b/lib/index.coffee @@ -81,10 +81,10 @@ preprocessAST = (ast) -> i = 0 out = [] orderedList = false - orderedListItemNumber = 0 while i < ast.length currentToken = ast[i] if currentToken.type is 'list_start' + orderedListItemNumber = 0 # this is actually all we need the list start token for orderedList = currentToken.ordered else if currentToken.type in nestingStartTokens diff --git a/test/index.coffee b/test/index.coffee index 9a7d7c2..2119e04 100644 --- a/test/index.coffee +++ b/test/index.coffee @@ -187,6 +187,26 @@ describe 'lists', -> - last item ''') + it 'should normalize ordered lists', -> + tidyMdSnippet(''' + # H1 header + 1. blah + 2. blah + 3. blah + + # another H1 header + 1. blah + 2. blah + ''').should.equal(''' + # H1 header + 1. blah + 2. blah + 3. blah + + # another H1 header + 1. blah + 2. blah + ''') describe 'inline grammar', -> it 'should handle special characters', ->