Page MenuHomePhabricator

Syntax highlighter does not display properly for file captions
Closed, DuplicatePublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Go here
  • Scroll to the code at
[[File:Texas medical center.jpg|thumb|The [[Texas Medical Center]] in downtown [[Houston]] is the largest medical complex in the world.|alt=The Texas Medical Center, a cluster of contemporary skyscrapers, at night]]

What happens?:
The light background highlighting ends after "Center]]".

What should have happened instead?:
The light background highlighting should end after "at night]]".

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Sdkb renamed this task from Syntax highlighter does not display to Syntax highlighter does not display properly for file captions.Sep 27 2021, 8:51 PM
MusikAnimal subscribed.

This is certainly a valid bug (perhaps closer to a feature request), however I feel it is low-priority. Furthermore we will likely be upgrading to CodeMirror 6 within the next year (T259059). This implementation is fundamentally different from the existing one, so it may not be worth it to tackle any low-ish priority bugs until the upgrade has happened.

If CodeMirror 6 is a whole new system, hopefully that'll resolve the issue. It's not the most annoying thing in the world, but wikilinks within captions are an extremely common occurrence, so it's very widespread.

If CodeMirror 6 is a whole new system, hopefully that'll resolve the issue

I doubt that resolves it, its more that we would have to reimplement it again in that system, and doing it twice is gonna be hard.

No the issue here is more that MediaWiki has a very badly defined set of allowed nesting with lots of side rules where behaviour depends on the surrounding wikitext. Wikitext is notoriously difficult to implement a language parser for, and therefore the CodeMirror highlighter just mostly doesn't deal with any of that nesting, to avoid having to be a full wikitext parser. This explains most of the CodeMirror tickets that are "something wikitext doesn't work inside of [x]".