gjtorikian/task-lists-js — pull request #3 by OnAzureWings (2014-04-11 21:43:05+00:00)
Title: Fix greedy checkbox/label wrapping on list elements

Grabbing the entire `innerHTML` for each list item in `$('li)` is too greedy, and can lead to problems when the output is rendered where CSS styles are applied to first/last-children.

Example Markdown:

```markdown
- [ ] item
- sub-item
- [ ] sub-item
- item
```
Currently, processing the markdown above yields the following HTML:

```html

item

sub-item

sub-item

item

```

Note that the first `` tag wraps both `sub-item`s.

Instead of the entire `innerHTML`, only get the list item that requires the checkbox rendered, and then append the children back on only after the `` tag has been closed.

This pull request fixes the processing and yields the following HMTL:

```html

item

sub-item

sub-item

item

```

Note that the first `` tag only wraps the list item that requires a checkbox and nothing more.

I added a test case to test/markdown.md starting on line 29 that should illustrate the problem with leading checkboxes.

Let me know if there are any questions/issues with what I've done.