Topic on Extension talk:SyntaxHighlight

SOURCE vs. SYNTAXHIGHLIGHT

7
Nicole Sharp (talkcontribs)

Not sure if this has already been posted, but for non-Wikimedia installations of MediaWiki 1.35.1 LTS (at least with DreamHost Shared Hosting), the syntaxhighlight element does not work but the source element does. This is very confusing since the extension page here on MediaWiki.org says that the source element is deprecated, though the README file included with the extension says to use the source element (which is how I figured out to get the syntax highlighting to work—otherwise I might not have guessed to try the supposedly deprecated source element). Nicole Sharp (talk) 03:23, 14 March 2021 (UTC)

Dinoguy1000 (talkcontribs)

Based on a quick skim of the page you linked, DreamHost is only a host service and doesn't provide MediaWiki installations for customers, meaning whatever wiki you were working on must have (for whatever reason) customized their copy of the SyntaxHighlight extension to use source instead of syntaxhighlight. Regardless, source is deprecated and support for it will be removed (probably in the REL1_37 branch once that gets cut). Whether individual wikis (or wiki farms) decide to change the extension to continue supporting source, or even to drop syntaxhighlight, is outside the purview of the extension's maintainers here.

Nicole Sharp (talkcontribs)

I installed MediaWiki myself using default settings for MediaWiki and SyntaxHighlight: https://www.nicolesharp.net/wiki/special:version. The only reason I mentioned the webhost is if the error has anything to do with the configurations of PHP or Python on the server. Not sure why syntaxhighlight does not work, but I am glad that source does. Removing support for the source element (regardless of whether it is officially deprecated or not), will remove support for the SyntaxHighlight Extension, at least for some wikis, so this should be avoided at all costs. It doesn't seem harmful to keep support for a redundant tag, especially if removing support will break the extension on some wikis. Nicole Sharp (talk) 13:47, 14 March 2021 (UTC)

Nicole Sharp (talkcontribs)

I currently only plan to do LTS upgrades of MediaWiki, so at the very least a legacy or LTS version of SyntaxHighlight should be maintained to keep support for the source element. Nicole Sharp (talk) 13:53, 14 March 2021 (UTC)

Nicole Sharp (talkcontribs)

I solved the problem. syntaxhighlight does not work due to my custom stylesheet at MediaWiki:vector.css, likely due to forcing the text color as black for the pre element. The reason that the source element works and the syntaxhighlight element does not may specifically be because the source element is deprecated, and thus not affected by the Vector stylesheet. All the more reason to keep a legacy element supported, so that users have an option to keep the SyntaxHighlight formatting even when custom stylesheets for the Vector Skin are in use. Nicole Sharp (talk) 14:07, 14 March 2021 (UTC)

Nicole Sharp (talkcontribs)

"source" is also easier to type and read than "syntaxhighlight" since it has less characters and syllables. Nicole Sharp (talk) 14:10, 14 March 2021 (UTC)

Dinoguy1000 (talkcontribs)

See phab:T237267 for the rationale for deprecating source, and phab:T251116 for suggestions for a new shorthand or alternative to syntaxhighlight. In particular, source is also the name of an unrelated HTML element, and in general, wikitext prefers not to reuse the names of unrelated markup from internet standards. Local styles conflicting with features of core or extensions aren't going to be a strong enough argument for changing those features, or for preserving deprecated functionality, since the fix is to simply remove or change the local styles.

Reply to "SOURCE vs. SYNTAXHIGHLIGHT"