PHRASING_ELEMS missing <u>, <s>, and <bdi> elements causes paragraph splitting
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.5k
- Forks
- 732
- PR merge metrics
- No merged PRs in 30d
Description
Problem
The PHRASING_ELEMS array is missing several HTML5 phrasing content elements: U, S, and BDI.
This causes Readability to incorrectly treat these inline elements as block-level, splitting paragraphs around them.
Example
Input HTML:
<p>Seigneur, mon Die<u>u</u> et mon salut</p>
Output (incorrect):
<p>Seigneur, mon Die</p><u>u</u><p> et mon salut</p>
The <u> tag is being treated as a block element, breaking the paragraph into three parts.
Solution
Add the missing phrasing content elements to PHRASING_ELEMS:
PHRASING_ELEMS: [
// ... existing elements ...
"BDI", // Bidirectional text isolation
"S", // Strikethrough
"U", // Underline
// ...
]
Per HTML spec, these are all valid phrasing content elements that should be kept inline within paragraphs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the codebase for the PHRASING_ELEMS array and inspect the tests covering paragraph splitting or phrasing elements. Add BDI, S, and U to the array, then run the relevant test suite and confirm that the example remains one paragraph while existing behavior is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100