dcwatson / bbcode

A pure python bbcode parser and formatter.
BSD 2-Clause "Simplified" License
68 stars 17 forks source link

Refuse to format list items which do not occur within a list tag #29

Closed Lanny closed 5 years ago

Lanny commented 6 years ago

BBCode such as [b][*]foo[/b] will currently render as <strong><li>foo</li></strong> which is invalid HTML as li elements are not permitted as children of strong tags, spec here. Depending on the parser, this can cause a phony list element to be inserted before and as parent to the first errant li tag, swallowing the remainder of the document (observed in chrome) or simply fail to parse.

This PR changes this behavior so that * tags which are not the immediate child of a list tag will not be rendered as HTML.

dcwatson commented 5 years ago

Thanks for the contributions!