Page MenuHomePhabricator

h2 have enlarged font sizes in WTE2017 with syntax highlighting
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

The font size is larger than normal, which causes text misalignment.

What should have happened instead?:

The font size should be normal, and there is no text misalignment.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Master branch of Extension:CodeMirror or beta clusters.

Other information (browser name/version, screenshots, etc.):

This is caused by a recent patch which increases the precedence of CodeMirror style rules.

Event Timeline

Change #1314761 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/CodeMirror@master] ve.ui.CodeMirror.less: ensure normal font size and weight

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

Change #1314761 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] ve.ui.CodeMirror.less: ensure normal font size and weight

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

Hmm, I was surprised by seeing this task title, as in the 2010 editor I'm accustomed to seeing these aspects formatted in a way that matches how they are rendered, e.g. [screenshot below]

image.png (717×1,008 px, 212 KB)
.
Personally, I find it very useful to have those clear indicators, as I can rapidly scroll in a long article and easily notice the ==Headers== because they are more prominent, plus I can easily see bold and italic text (especially when it's surrounded by quotation marks). I can understand how the change might be surprising to end-users, if it wasn't previously the default in the 2017 editor(?!), but I would want to have this feature available if/when I moved to the 2017 editor! Just a thought.

@Quiddity In the 2017 editor, CodeMirror only adds an overlay layer and the layer has to align with the underlying contenteditable. As a result, we cannot change font size or font weight in CodeMirror, either of which will cause misalignment between the contenteditable and the CodeMirror overlay.

Bhsd claimed this task.
Bhsd moved this task from Bugs to Done on the MediaWiki-extensions-CodeMirror board.

@Quiddity this is actually something the codemirror-branch for T432558 could be made to do, since it's offloading the formatting to the VE surface it has a lot more room to start adjusting things without needing to care about alignment.

this is actually something the codemirror-branch for T432558 could be made to do.

No, ::highlight() does not support either font-size or font-weight.

Yeah, but since that branch is founded on telling NWE about the tokens we could absolutely have it also tell it that a given paragraph needs a css class added to it…

@Bhsd This does indeed turn out to be quite doable:

CleanShot 2026-07-25 at 11.49.54@2x.png (1,470×1,074 px, 340 KB)