A patch to JsonCodec added "abbreviation" support to the codec. This allows using arbitary strings to abbreviate full type hints. We can implement the rich attribute accessors to default to a type abbreviation based on the attribute name, for example @attr-data-mw when getting/setting the value of the data-mw attribute. The codec is initialized with a mapping from abbreviations to type hints, which serves as the de facto schema for the document. We can detect the presence of attributes with rich data by consulting the abbreviation map (aka, schema): if there is an attribute named foo on the element and there's a hint defined for @attr-foo, then we should load the value of that attribute when traversing content. This doesn't in itself tell us where in the loaded value an embedded document fragment might be located, but perhaps an interface method could be defined for this purpose. This ties the schema and the codec fairly tightly to the PHP implementation, and mostly abandons the idea of a separate implementation-independent schema, but it would still be possible to port the codec and traversal code to other languages.
Description
Details
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Resolved | ssastry | T214994 PP passes that run `atTopLevel` omit HTML stashed in data-mw | |||
| Open | cscott | T339927 Rich Attribute Support in Parsoid | |||
| Open | None | T348165 Parsoid Rich Attributes phase 3 | |||
| Open | cscott | T424427 Rich Attributes Phase 3 Alternative 3c: implicit schema via attribute registry | |||
| Open | cscott | T428534 Remove embedded HTML from data-parsoid |
Event Timeline
Change #1236842 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):
[mediawiki/services/parsoid@master] WIP: Parsoid Extension modules can now register codec hints for new attributes
Change #1236842 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Parsoid Extension modules can now register codec hints for new attributes
Change #1299571 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.24.0-a8
Change #1299571 merged by jenkins-bot:
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.24.0-a8
Change #1299588 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):
[mediawiki/vendor@wmf/1.47.0-wmf.6] Bump wikimedia/parsoid to 0.24.0-a8
Change #1299588 merged by jenkins-bot:
[mediawiki/vendor@wmf/1.47.0-wmf.6] Bump wikimedia/parsoid to 0.24.0-a8
Mentioned in SAL (#wikimedia-operations) [2026-06-09T20:39:15Z] <cscott@deploy1003> Started scap sync-world: Backport for [[gerrit:1299588|Bump wikimedia/parsoid to 0.24.0-a8 (T378906 T420336 T424427 T427664 T427972 T428452 T428270)]], [[gerrit:1299589|Bump wikimedia/parsoid to 0.24.0-a8 (T428270)]]
Mentioned in SAL (#wikimedia-operations) [2026-06-09T20:41:15Z] <cscott@deploy1003> cscott: Backport for [[gerrit:1299588|Bump wikimedia/parsoid to 0.24.0-a8 (T378906 T420336 T424427 T427664 T427972 T428452 T428270)]], [[gerrit:1299589|Bump wikimedia/parsoid to 0.24.0-a8 (T428270)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.
Mentioned in SAL (#wikimedia-operations) [2026-06-09T20:50:28Z] <cscott@deploy1003> Finished scap sync-world: Backport for [[gerrit:1299588|Bump wikimedia/parsoid to 0.24.0-a8 (T378906 T420336 T424427 T427664 T427972 T428452 T428270)]], [[gerrit:1299589|Bump wikimedia/parsoid to 0.24.0-a8 (T428270)]] (duration: 11m 13s)