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 217 forks source link

Parser wrapItemPara results in AST that is different from what blank lines in list produce. #192

Closed vsch closed 9 years ago

vsch commented 9 years ago

In a nutshell, list items are recursively parsed so there is always a RootNode at the start of an item. If the list item is wrapped in Para node because it had a blank line it breaks the pattern and makes it harder to work with the AST.

Simple solution is to wrap the list items children in RootNode( ParaNode ( children)) so that it is identical to what an unmolested loose list item would look like. This makes task list item HTML serialization hell because an <input> must be injected into the item. Much easier if the AST is consistent.

Fixed with tests. PR in the oven.