Jump to content

Topic on Extension talk:SyntaxHighlightPages

how to replace SyntaxHighlight for file extension

5
Nicole Sharp (talkcontribs)

How do I change the SyntaxHighlight for mac files so that they are highlighted as ma files instead? Wolfram Mathematica (Pygments language mma) ma filetype is the closest I can find in Pygments to represent Maxima mac files (which is not included with Pygments), but the mac filetype is already assigned in Pygments to Easytrieve (Pygments language easytrieve). Nicole Sharp (talk) 17:15, 14 March 2021 (UTC)

Nicole Sharp (talkcontribs)

It might be easier if the Pygments language could be manually selected as the page content model, instead of a generic "syntaxhighlight." This would allow for example XHTML files saved as htm to be displayed using either Pygments html or Pygments xml. Nicole Sharp (talk) 17:25, 14 March 2021 (UTC)

Gittenburg (talkcontribs)

Selecting a language is out of the scope of this extension.

More feasible would be allowing extensions to be mapped to lexer names like:

$wgSyntaxHighlightPagesSuffixes = ["htm" => "html"];

I opened an issue for this on GitHub. While I don't have time to implement this, I would accept a pull request that implements this feature.

Nicole Sharp (talkcontribs)

Being able to manually assign languages to file extensions would definitely be helpful. Extension:Highlightjs_Integration allows this type of customization. Would it be possible to apply HighlightJS instead of Pygments for SyntaxHighlightPages? HighlightJS supports Maxima whereas Pygments does not. The closest language to Maxima (maxima / .mac) in Pygments is actually mupad (.mu) instead of mma (.ma) but full Maxima support would be better. Nicole Sharp (talk) 22:32, 8 April 2021 (UTC)

Gittenburg (talkcontribs)

I'm afraid switching to Highlightjs is also out of the scope of this extension. Mapping extensions to languages could be very easily implemented but I don't have the time for it -- however someone responded on GitHub maybe they'll implement it.

Once this has been solved you might be able to use https://github.com/FoamScience/maximalexer ... pygments allows the installation of unofficial lexers, but I don't know how easy it is to use them with the MediaWiki extension.

Reply to "how to replace SyntaxHighlight for file extension"