Page MenuHomePhabricator

Highlight attribute name and attribute string separately
Open, Needs TriagePublic

Description

CodeMirror is able to highlight tag attribute names and values separately in HTML mode.

The MediaWiki mode is missing this feature:

image.png (32×221 px, 1 KB)

Here's what it should probably look like, complete with colors (SyntaxHighlight):

image.png (60×276 px, 2 KB)

It seems like a backwards step to highlight the entire attribute collection as one node. Splitting it up allows for proper validation against malformed extension tag or HTML attributes.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I'll try do this when I wrap my head around the MediaWiki mode file in CodeMirror's Lezer parser.

Its relatively easy to adapt the entire attribute to have a separate color, as it already has its own classname: cm-mw-htmltag-attribute

Screenshot 2022-03-08 at 13.55.27.png (87×281 px, 8 KB)

Highlighting the value separately from the name of the attribute requires adapting the parser however.