parser icon indicating copy to clipboard operation
parser copied to clipboard

<span>s whose parents are <li>s shouldn't be converted to <p>s

Open Wevah opened this issue 5 years ago • 2 comments

  • Platform: Whatever Feedbin is using (tested on macOS 10.15.2 as well)
  • Mercury Parser Version: 2.2.x (git commit b0e708a)
  • Node Version (if a Node bug): 12.14.1
  • Browser Version (if a browser bug): N/A

Expected Behavior

span elements who are direct descendants of an li shouldn't be converted to p.

Current Behavior

span elements who are direct descendants of an li are converted to p.

Steps to Reproduce

Parsing https://lindenbergsoftware.com/en/notes/bringing-balinese-to-ios/index.html leads to this issue (see: https://github.com/Ranchero-Software/NetNewsWire/issues/1739)

Detailed Description

It messes up the post formatting.

Possible Solution

Update the list of non-convertable parent elements to include li.

If leaving out li is intentional, I'd like to figure out another fix.

Wevah avatar Jan 29 '20 23:01 Wevah

It’s not just li – the same article also uses span within figcaption, and the HTML spec allows span wherever phrasing content is allowed. It seems span should only be converted if there’s no element among its ancestors that can contain phrasing content.

NorbertLindenberg avatar Jan 30 '20 06:01 NorbertLindenberg

Thanks; I wasn’t as thorough as I should have been.

Wevah avatar Jan 30 '20 06:01 Wevah