Page MenuHomePhabricator

Implement explicit backlink markers for Parsoid
Open, Needs TriagePublic

Description

Context:
We want to get rid of the CSS based mechanism for the backlink markers in Parsoid so that it's more aligned with legacy parser output, allows more easy customization and be ready for sub-referencing. See T370027: [Epic] Parsoid CSS counter reset footnote/backlink mechanism should be dropped in favor of plain text

Implementation:

Out of scope:

  • Migration to the new mechanism

Notes:
This feature is expected to also resolve:

Related Objects

Event Timeline

WMDE-Fisch renamed this task from Use explicit backlink markers in Parsoid to Parsoid: explicit backlink markers.Jan 29 2025, 1:34 PM
WMDE-Fisch updated the task description. (Show Details)

While doing a proof of concept, I ran into some obstacles. It might be better to attempt Parsoid support only after these underlying issues are addressed:

  • The customization of "↑" in isolation is theoretically possible already with cite_reference_backlink_symbol but this currently only affects WikiEditor and is therefore not a common customization. Only two wikis have done so. The much more common customization is as part of the larger messages cite_references_link_one and cite_references_link_many which are entangled with legacy parser HTML structure and cannot be reused in our new code.
  • Our MarkSymbolRenderer service is mixing the footnote marker and backlink marker use cases. Reuse will take some careful design because: * group is currently ignored for backlinks (we might want to reconsider eg. switching between alpha and numeric to contrast with numeric/alpha custom groups), and * backlink formatting has the special case when the count==1.
  • Backlink alphabet calculations feel slightly expensive so we've inlined the different steps in a big function in MarkSymbolRenderer. To call the renderer in a more isolated way would probably benefit from some level of internal caching.

Change #1115354 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [WIP] Explicit HTML for backlink markers

https://gerrit.wikimedia.org/r/1115354

The customization of "↑" in isolation is theoretically possible already with cite_reference_backlink_symbol but this currently only affects WikiEditor and is therefore not a common customization. Only two wikis have done so. The much more common customization is as part of the larger messages cite_references_link_one and cite_references_link_many which are entangled with legacy parser HTML structure and cannot be reused in our new code.

So using cite_reference_backlink_symbol is a customization we would prefer over the symbol being part of cite_references_link_one and cite_references_link_many ?

So using cite_reference_backlink_symbol is a customization we would prefer over the symbol being part of cite_references_link_one and cite_references_link_many ?

We could start there, although it would be wrong for almost every wiki until adjusted by an interface admin, so it's not exactly an elegant migration path. The best solution IMHO is that we make it customizable in Community Configuration right away...

Change #1115448 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [WIP] Hide CSS-styled backlink markers, show explicit HTML

https://gerrit.wikimedia.org/r/1115448

Change #1115449 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [WIP] Clean up unused Parsoid backlink CSS

https://gerrit.wikimedia.org/r/1115449

Change #1115354 abandoned by Awight:

[mediawiki/extensions/Cite@master] [WIP] Explicit HTML for backlink markers

Reason:

split into smaller pieces

https://gerrit.wikimedia.org/r/1115354

thiemowmde renamed this task from Parsoid: explicit backlink markers to Extract backlink marker renderer service for both parsers.Feb 5 2025, 9:30 AM
thiemowmde added subscribers: awight, thiemowmde.

Change #1115446 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Awight):

[mediawiki/extensions/Cite@master] Backlink mark rendering service

https://gerrit.wikimedia.org/r/1115446

WMDE-Fisch renamed this task from Extract backlink marker renderer service for both parsers to Implement explicit backlink markers for Parsoid.Feb 5 2025, 10:07 AM
WMDE-Fisch updated the task description. (Show Details)

Change #1115447 had a related patch set uploaded (by Awight; author: Awight):

[mediawiki/extensions/Cite@master] [WIP] New-style ref backlink markers for parsoid

https://gerrit.wikimedia.org/r/1115447