Page MenuHomePhabricator

Deprecate non-xml-compliant uses of attributes
Open, LowPublic

Description

SyntaxHighlight seems to use some attributes in bare form, <syntaxhighlight lang="bash" inline>...</syntaxhighlight>. Parsoid will not roundtrip these forms in non-selser modes and will always emit <syntaxhighlight lang="bash" inline="">...</syntaxhighlight>.

It might be worth it to deprecate the usage of the bare attribute form (maybe via linter or a tracking category) and encourage a transition to the XML syntactic form to encourage consistent syntax for all XML-like tags.

Event Timeline

HTML has boolean attributes e.g. <track default>, <video controls>, and others. If an extension defines a keyword that shares a name with an HTML attribute (like core's overriding of <pre> to some extent, which nowikis its content) that is boolean, it may need to be supported like that. HTML does allow the form boolean="" or boolean="boolean" according to SO (verify as desired), but for e.g. Syntaxhighlight, inline="inline" sure does look like noise.

OTOH, <math> (the extension, not the HTML tag) has <math display=block> (where absent, defaulting to inline), so <syntaxhighlight display=inline> probably isn't going to kill anyone and would change it from a question of "looks like HTML" to "looks like a tag use", but does exacerbate the "it's already a long tag name" cf. T251116: Have a shorter name for <syntaxhighlight>.

Parsoid will still dirty those attributes, yes. But, it is low-priority in that it probably affects a small set of edits (when selective serialization doesn't kick in). Eventually, all existing uses will get replaced with inline="" form. So, if syntaxhiglight doesn't want that normalization, worth thinking of how to address this. This is not something that the Content Transform Team is likely to take up since there is a lot of other work we need to get done.