sirthias / pegdown

A pure-Java Markdown processor based on a parboiled PEG parser supporting a number of extensions
http://pegdown.org
Apache License 2.0
1.29k stars 218 forks source link

New Optional Extension TASKLISTITEMS to parse and generate HTML for GFM task list items #185

Closed vsch closed 9 years ago

vsch commented 9 years ago

These are bullet lists of the form:

* [ ] open task list
* [x] closed task list

And generates:

<ul>
  <li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled="disabled"></input>open task list</li>
  <li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" checked="checked" disabled="disabled"></input>closed task list</li>
</ul>

to look like:

provided the style sheet is provided to properly setup the list item generation and spacing.

The parser, ToHtmlSerializer and a new TaskListNode extending ListItemNode was added. New tests added to validate output when this extension is enabled and disabled. I will submit a PR with other fixes.

NOTE: this is an optional extension not included in Extensions.ALL