-
Notifications
You must be signed in to change notification settings - Fork 435
Description
I have this chunk of content:
<div>
<ul>
<li>item 1</li>
<li>item 2</li>
<p>paragraph</p>
some text
</div>
when i run it through tidy, I end up with this:
<div>
<ul>
<li>item 1
</li>
<li>item 2
</li>
<li style="list-style: none; display: inline">
<p>
paragraph
</p>some text
</li>
</ul>
</div>
What I was expecting was this:
<div>
<ul>
<li>item 1</li>
<li>item 2</li>
</ul>
<p>paragraph</p>
some text
</div>
According to http://w3c.github.io/html/grouping-content.html#elementdef-ul, a ul tag can only contain li tags, or script-enabled elements, so I thought perhaps it would close once it reached the first invalid element (the 'p' tag). Instead, it took every remaining element and constructed an li around them so it would work.
Is there a way that I can use tidy to get my desired result, and have it close a tag as soon as it encounters a situation where adding the node would result in invalid markup? I've looked through the configuration options, but none of them seemed suited for this purpose. Is there a way to have tidy never create new tags, and only have it close existing tags?