Page MenuHomePhabricator

Apply syntax highlighting to eligible pages during diffs and page previews
Closed, ResolvedPublic

Description

When viewing a diff from the page history of a page that gets highlighting, the rendered version shown (below the diff) is displayed without highlighting and in a variable width font.
Also, prolly separate bug, but when previewing the same page there is no preview shown at all.


Version: unspecified
Severity: minor

Details

Reference
bz10871

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:49 PM
bzimport added a project: SyntaxHighlight.
bzimport set Reference to bz10871.

There is a current problem, in that when diffing js pages, the page sometimes can be difficult to read, as JS sometimes includes absolutely positioned divs etc...

It refers to auto-highlighted pages (js/css)

as it can introduce problem viewing some sort of page actions, then I don't think it should be described as "enchantment"

robchur wrote:

There's effectively two issues, here then; MediaWiki's lousy handling of such pages during diffs and previews, and its failure to call the appropriate hook for the extension.

One's a bug, one's theoretically an enhancement.

Yes, it can both be seen as an enhancement and a bug. To visualize a potential buggy part of this, I've created an example javascript page, perhaps some would do a script similar to that, to display some sort of splash screen. The code is at http://en.wikipedia.org/wiki/User:AzaToth/differror.js and the problem is viewed at http://en.wikipedia.org/w/index.php?title=User:AzaToth/differror.js&diff=163690181 for example.

Not exactly sure but as of MediaWiki v1.16.0beta3 I still see pages like MediaWiki:Vector.js not using <pre> tags at all during preview.

Diff-view has been fixed though.

Note: My test-install did not include the SyntaxHighlighing extension at this point. But js/css pages are rendered in <pre> by core functionality aswell. And that seems to be broken when previewing.

Ofcourse when editing user-scripts and (via the Gadgets extension) these are (sometimes?) executed when previewing the page so those probably dont need any change during preview.

So I guess it's MediaWiki not recognizing it's supposed to render it as sourcecode when previewing. And thus neither the core function to wrap in <pre>, nor third party extensions can hook that.

So, change the component to MW core ?

1.16wmf4: Yes, diffs seem fixed and preview of .css and .js files in User: space seems disabled (for good reason), but preview of .css and .js files in MediaWiki: space remains being rendered as wikitext; they also need highlighting, or at least be wrapped in <pre>.

Fixed in r77981. Only <pre> formatting is used, since the hook used by SyntaxHighlighting is not appropiate there.