fix: strip <ol>-only attrs (start, type, reversed) from <li>/<dd>#187
Merged
Conversation
added 3 commits
May 20, 2026 02:17
start, type, reversed are HTML attributes valid only on <ol>. When authored on a list item (or <dd>) they currently pass through to the <li>/<dd> tag, producing invalid HTML. These tests pin the target behavior: silently strip those three names from <li>/<dd> output while leaving class, id, data-*, etc. unchanged.
When an author puts start/type/reversed on a list item or <dd> (e.g.
via the postfix {start=5} attribute line), the HTML renderer
previously passed them through to <li>/<dd>, producing invalid HTML.
These attributes are valid only on <ol>, so silently strip them from
list-item / definition-description output. class, id, data-*, etc.
are unchanged. <ol> attributes derived from a preceding block-attr
line still emit normally.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #187 +/- ##
=========================================
Coverage 91.12% 91.12%
Complexity 3354 3354
=========================================
Files 99 99
Lines 8575 8575
=========================================
Hits 7814 7814
Misses 761 761 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dereuromark
added a commit
that referenced
this pull request
May 20, 2026
Documents the governing principle ("attributes precede their target;
adjacency selects the tighter target where supported") and a single
table covering all djot-php attribute targets (block, inline, <li>,
<dt>, <dd>, <dl>, table row, table cell, marker-glyph not-addressable
note). Notes the start/type/reversed strip on <li>/<dd> (#187) and
the list-item last-content-line rule (#186).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strips three
<ol>-only HTML attribute names —start,type,reversed— from the rendered<li>and<dd>output. These attributes are HTML-valid only on<ol>; when an author put them on a list item (e.g. via the postfix{start=5}line) they previously passed through to<li>and produced invalid HTML.Before / after
Input:
Before:
After:
The legitimate way to set
<ol start="5">(a block-attribute line before the list) is unchanged.Tests
Six new test methods in
tests/TestCase/DjotConverterTest.phpcovering:start/type/reversedstrip on<li>, pass-through of other attributes (class/id/data-*),starton<ol>from a block-attribute line still works, and<dd>parity.Docs
Notes added under "List Item Attributes" and "Definition List Element Attributes" in
docs/reference/enhancements.md.Related
Part of the attribute-hardening sweep. Sibling: #186 (G2 list-item terminator fix, merged), #185 (marker-adjacent tracking).