chjj/marked — pull request #31 by leeoniya (2012-02-13 15:54:09+00:00)
Title: better handling of list indentation

fixes erroneous leading space in `` blocks within list items. eg Ruby/Rails blocks here: https://raw.github.com/mojombo/github-flavored-markdown/gh-pages/_site/sample_content.md

the previous list indentation behavior outdented list items up to the indentation level forced by the leading number or bullet. while this accounted for any number of list items, it also was unable to handle the case with nested code blocks. such as this:

```
1. In Ruby you can map like this:

['a', 'b'].map { |x| x.uppercase }

2. In Rails, you can do a shortcut:

['a', 'b'].map(&:uppercase)
```

there are 3 chars to outdent according to the first line, but the code blocks are indented 8 spaces, as per spec. this caused the code to also be outdented by 3 spaces, leaving 5. Then 4 are stripped by the `` sub-parser leaving 1 erroneous leading space _inside_ the code block.

while this patch may partially break the handling of 3-digit list items (100+), it fixes a more common scenario of not intentionally needing leading spaces on indent-aligned list sub-items.