Skip to content

markdown: add test for multiple lists #1664

@floydbj

Description

@floydbj

I was just going to suggest adding an additional test to ensure that the code handles multiple lists properly. In my solution to the problem, I used a regex to insert the <ul> tags at the appropriate locations. Originally I had just (<li>.*</li>) which passed all the tests, but which will work ONLY WHEN YOU HAVE A SINGLE LIST in your markdown text. If you have more than one, it'll put a single pair of <ul> tags around all of them (beginning of the first, end of the last) and whatever headers and paragraphs are found between.

My current regex (<li>.*?</li>)(<[ph])|(<li>.*</li>) handles multiple lists correctly, as far as I can tell. The first half (before the '|') catches string-initial or internal lists, while the latter half will kick in to handle string-terminal lists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions