Parsoid/Parser Unification/Cite CSS
This page describes features being actively worked on by the Wikimedia Germany Technical Wishes team as part of their ongoing focus area reusing references.
Parsoid CSS for footnote numbering
editBackground
editWikis that use localized numbering schemes for references (e.g. [۶]
on Persian Wikipedia) currently rely on CSS styling in Parsoid read mode and in VisualEditor .
The original parser localizes the markers as plain HTML, and we will move towards rendering plain HTML from Parsoid as well.
How can I help?
editCurrent phase: on-wiki CSS cleanup for footnote markers
editDuring and after this transition there should be no difference for readers, this is purely a cleanup.
Example
editAll of the examples below may be removed if they appear on your wiki.
/*.mw-ref > a::after {
content: '[' counter( mw-Ref, decimal ) ']';
}*/
.mw-ref > a[data-mw-group]::after {
content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, decimal ) ']';
}
.mw-ref > a[data-mw-group=lower-alpha]::after {
content: '[' counter( mw-Ref, lower-alpha ) ']';
}
.mw-ref > a[data-mw-group=kurdish-alpha]::after {
content: '[' counter( mw-Ref, kurdish-alpha ) ']';
}
.mw-ref > a[data-mw-group=georgian]::after {
content: '[' counter( mw-Ref, custom-group-label-georgian ) ']';
/* And if a custom @counter-style exists only to support this rule, it can be removed as well. */
}
Project timeline
edit- Done The localized footnote numbers are included in Parsoid HTML, same as is done in the legacy parser. T377454
- Done Override the local and global CSS styles responsible for the Parsoid footnote markers and de-facto disable them so that only the HTML is visible. T382310
- In progress Remove on-wiki Parsoid CSS rules to localize footnote marker numbering. T377458
- Development team removes any remaining on-wiki "mw-Ref" rules.
- TBD: Final cleanup of Cite code to support footnote numbering CSS. T386184
- TBD: Make backlink numbering explicit. T384948
- TBD: Make reference list numbering explicit (both parsers). T378570
If you notice any undesirable changes to references, please leave a comment on the discussion page.
Parsoid CSS elsewhere in Cite
editReference list numbering
editReference lists are still rendered using browser counter styling on the <li> tag, which is error-prone and doesn't support all languages. This may as well be rewritten to use explicit numbering instead.
Backlink markers for reused refs
editThe backlink markers ("1.0, 1.1" or "a, b, c") on reused references in the reference list will also be changed but in a later phase of work. We plan to phase out numbered markers and default to alphabetic symbols localized to the wiki's content language. These will still be customizable but through a simpler mechanism than the system messages .
Square brackets
editSome projects prefer to hide square brackets around the footnote markers. Currently this is done by adding custom CSS classes around brackets in the local MediaWiki:Cite reference link message and custom rules to MediaWiki:Common.css. This is not supported by Parsoid and VisualEditor.
Now there's a mechanism available that's compatible with Parsoid and VisualEditor which makes it possible to hide square brackets just using CSS rather than by editing system messages. It's also working with the legacy parsing and can be used there when MediaWiki:Cite reference link is unchanged or changes in there reverted.
Hiding the square brackets should now be done using the following CSS in MediaWiki:Common.css or in your user stylesheet:
.mw-references .cite-bracket {
font-size: 0;
}
Using font-size: 0
has the advantage of making the square brackets still show up when copy-pasting as unformatted text.
display: none
is not recommended because this will remove the brackets from the content in most browsers, leading to confusing copy-paste such as 2025[1]
turning to 20251
.
Ideally affected projects with customized Cite_reference_link message could remove this message altogether when they tweaked their CSS rules.