Extension talk:SyntaxHighlight GeSHi/Archive 2015

=2015=

With lang="sql" getting uppercase string SQL after a dot
Code:

Results in

@rdbms/admin/dbmsstat.SQL @rdbms/admin/prvtstat.plb @rdbms/admin/utlrp.SQL

It seems only to be happening with the sql-extension. I know that when running the above commands you can leave out the sql-extension, but it happens also when I want to spool output to another sql-file, and then I can't omit the extension.

The workaround is to put it between double quote, e.g @"rdbms/admin/dbmsstat.sql" but that doesn't look too nice in my wiki-page.

Thought to solve it by editing sql.php in extensions/SyntaxHighlight_GeShi/geshi/geshi and remove SQL from the keywords-array but that didn't solve it.

I run a site with Mediawiki 1.23.10. And it also happens when using source lang="sql" instead of syntaxhighlight.

Is this a bug or an (undocumented) feature? Or am I overlooking something completely?

Code with &lt;dl&gt;s cause bad things
There's a bug that I'm running into:
 * Here's a dt
 * Here's a dd that contains code with line numbers
 * And here's one that doesn't have numbers
 * That did not work so well...
 * That did not work so well...
 * That did not work so well...

Gives:


 * Here's a dt
 * Here's a dd that contains code with line numbers
 * And here's one that doesn't have numbers
 * That did not work so well...
 * That did not work so well...
 * That did not work so well...

Eric Wieser (talk) 19:28, 22 May 2015 (UTC)

Loading method
Hello, It is said in the extension's wikipage that SyntaxHighlight_GeSHi should be load with : In my case (mw 1.24), it breaks the server (it gives blank page for every requests)

This worked fine :

Can be a good idea to adapt the page to avoid other mistakes.

Thanks for your work !

Jona (talk) 07:41, 22 June 2015 (UTC)


 * Thanks for mentioning this. This was documented on the extension's page by now. --&#91;&#91;kgh&#93;&#93; (talk) 12:53, 22 July 2015 (UTC)

Wrong C++ highlighting (solved)

 * This is a bug report for the C++ lexer, where can I post it? The GeSHi project in the link on the top of this site does not longer exist … --Prog (talk) 20:18, 26 June 2015 (UTC)
 * I have reported it at pygments, the new base of the SyntaxHighlight extension. --Prog (talk) 15:07, 28 June 2015 (UTC)

I have some wrong highlightings in the Version on de.wikibooks (same as here):

Here are the formal definitions of C++ literals:
 * integer_literal
 * floating_literal
 * character_literal
 * string_literal
 * user_literal (not described above, but also not supported by GeSHi)

Kind regards! --Prog (talk) 18:57, 26 June 2015 (UTC)

line property destroys copy & paste code (solved)
When I use the line property, I can't select the source without the line numbers:

This is very disruptive! The line property is a very nice feature, but it destroys all my code examples when I use copy & paste, so I can not use it without much trouble for the readers. --Prog (talk) 20:16, 26 June 2015 (UTC)


 * solved via CSS:  on Mediawiki:common.css. --Prog (talk) 15:37, 28 June 2015 (UTC)

MediaWiki:Geshi.css
Since the GeSHi update, all the present code is non-functional, as none of the referenced classes are no longer used. However, what is the status of MediaWiki:Geshi.css? Is it still loaded? 14:42, 28 June 2015 (UTC)


 * I guess this needs to be filed on Phabricator. Currently no developer seems to be involved in looking at this talk page. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 12:51, 22 July 2015 (UTC)


 * Doesn't seem even basic diligence was exercised in testing it or considering the needs of the vast number of end users, given the large number of breaking changes. I wonder why this couldn't be done as a new alternate extension for people who weren't happy with the GeSHi-based one instead of overwriting what was a stable product for years. --QuasarEE (talk) 16:22, 24 July 2015 (UTC)

inline
Please deprecate  and suggest   for proper XML. Some of us (=me+maybe others) still recall the hilarious  in XHTML1, and not all backward steps in HTML5 are better than XHTML1 transitional. –Be..anyone (talk) 22:19, 16 July 2015 (UTC)

Can't use SyntaxHighlight inline with a list
In the past i was able to use the extension Extension:Code with a list like this,
 * the code

And the code block was indent correctly.

But now when i use SyntaxHighlight the same way it brakes horribly (you can see it here http://imgur.com/a/wCjp8), and i need to put the opening tag on a new line to make it work.

I'm running
 * MW 1.25.1
 * SyntaxHighlight 1.0.8.12

-- UPDATE I downloaded a new version of SyntaxHighlight (Version 2.0) from the git, extracted it, and installed with composer, and it seems to work like before.

REL1_24 currently broken
→ Filed as 

To fix this line 39 of "SyntaxHighlight_GeSHi.php" has to be commented out. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 12:49, 22 July 2015 (UTC)

SyntaxHighlight geshi isent working for me
Hi I am using mediawiki 1.26 wmf 17 and latest code from master branch from today my wiki at http://en.random-wikisaur.tk/wiki/MediaWiki:Common.css isent highlighting anything since using new code because of switch from geshi to another syntax highlighter how do I enable it to highlight it is using all the default settings for syntaxhighligh geshi. Paladox2017 (talk) 16:42, 6 August 2015 (UTC)
 * bump Paladox2017 (talk) 15:20, 5 September 2015 (UTC)

An omission in the installation instructions
The installation instructions say

Download and place the file(s) in a directory called SyntaxHighlight_GeSHi in your extensions/ folder. Add the following code at the bottom of your LocalSettings.php:

Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Err, what code? Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 08:18, 10 August 2015 (UTC)
 * Hi this has been fixed. This was misktake when the template was updated. Should work now Paladox2017 (talk) 13:09, 12 August 2015 (UTC)
 * Okay, it's fine now. Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 18:43, 13 August 2015 (UTC)

Pigments Missing?
I'm seeing the following error when trying to use the master build of Syntaxhighlighter with MW 1.26wmf16. I cloned the repo, ran composer install and even went in and ran 'python create_pygmentize_bundle' in SyntaxHighlight_GeSHi/pygments/pygmentize. Code blocks are showing up and unformatted blocks and the ""Pages with syntax highlighting errors" category is being applied.

The most interesting chunk of the below error is this portion (to me at least).

[warning] Failed to invoke Pygments. Please check that Pygments is installed and that $wgPygmentizePath is accurate. [Called from SyntaxHighlight_GeSHi::highlight in /var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php at line 2

[error-json] {&quot;id&quot;:&quot;5b24bf3b&quot;,&quot;type&quot;:&quot;ErrorException&quot;,&quot;file&quot;:&quot;/var/www/html/w/extensions/SyntaxHighlight_GeSHi/vendor/symfony/process/Process.php&quot;,&quot;line&quot;:1102,&quot;message&quot;:&quot;PHP Deprecated: The Symfony\\Component\\Process\\Process::setStdin method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput method instead.&quot;,&quot;code&quot;:0,&quot;url&quot;:&quot;/wiki/Test_Entry&quot;,&quot;suppressed&quot;:true,&quot;backtrace&quot;:[{&quot;function&quot;:&quot;handleError&quot;,&quot;class&quot;:&quot;MWExceptionHandler&quot;,&quot;type&quot;:&quot;::&quot;,&quot;args&quot;:[&quot;integer&quot;,&quot;string&quot;,&quot;string&quot;,&quot;integer&quot;,&quot;array&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/extensions/SyntaxHighlight_GeSHi/vendor/symfony/process/Process.php&quot;,&quot;line&quot;:1102,&quot;function&quot;:&quot;trigger_error&quot;,&quot;args&quot;:[&quot;string&quot;,&quot;integer&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/extensions/SyntaxHighlight_GeSHi/vendor/kzykhys/pygments/src/KzykHys/Pygments/Pygments.php&quot;,&quot;line&quot;:65,&quot;function&quot;:&quot;setStdin&quot;,&quot;class&quot;:&quot;Symfony\\Component\\Process\\Process&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;string&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php&quot;,&quot;line&quot;:279,&quot;function&quot;:&quot;highlight&quot;,&quot;class&quot;:&quot;KzykHys\\Pygments\\Pygments&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;string&quot;,&quot;string&quot;,&quot;string&quot;,&quot;array&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php&quot;,&quot;line&quot;:125,&quot;function&quot;:&quot;highlight&quot;,&quot;class&quot;:&quot;SyntaxHighlight_GeSHi&quot;,&quot;type&quot;:&quot;::&quot;,&quot;args&quot;:[&quot;string&quot;,&quot;string&quot;,&quot;array&quot;]},{&quot;function&quot;:&quot;parserHook&quot;,&quot;class&quot;:&quot;SyntaxHighlight_GeSHi&quot;,&quot;type&quot;:&quot;::&quot;,&quot;args&quot;:[&quot;string&quot;,&quot;array&quot;,&quot;Parser&quot;,&quot;PPFrame_DOM&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/parser/Parser.php&quot;,&quot;line&quot;:4228,&quot;function&quot;:&quot;call_user_func_array&quot;,&quot;args&quot;:[&quot;array&quot;,&quot;array&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/parser/Preprocessor_DOM.php&quot;,&quot;line&quot;:1260,&quot;function&quot;:&quot;extensionSubstitution&quot;,&quot;class&quot;:&quot;Parser&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;array&quot;,&quot;PPFrame_DOM&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/parser/Parser.php&quot;,&quot;line&quot;:3336,&quot;function&quot;:&quot;expand&quot;,&quot;class&quot;:&quot;PPFrame_DOM&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;PPNode_DOM&quot;,&quot;integer&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/parser/Parser.php&quot;,&quot;line&quot;:1231,&quot;function&quot;:&quot;replaceVariables&quot;,&quot;class&quot;:&quot;Parser&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;string&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/parser/Parser.php&quot;,&quot;line&quot;:434,&quot;function&quot;:&quot;internalParse&quot;,&quot;class&quot;:&quot;Parser&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;string&quot;]},{&quot;function&quot;:&quot;parse&quot;,&quot;class&quot;:&quot;Parser&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;string&quot;,&quot;Title&quot;,&quot;ParserOptions&quot;,&quot;boolean&quot;,&quot;boolean&quot;,&quot;integer&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/StubObject.php&quot;,&quot;line&quot;:105,&quot;function&quot;:&quot;call_user_func_array&quot;,&quot;args&quot;:[&quot;array&quot;,&quot;array&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/StubObject.php&quot;,&quot;line&quot;:129,&quot;function&quot;:&quot;_call&quot;,&quot;class&quot;:&quot;StubObject&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;string&quot;,&quot;array&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/content/WikitextContent.php&quot;,&quot;line&quot;:331,&quot;function&quot;:&quot;__call&quot;,&quot;class&quot;:&quot;StubObject&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;string&quot;,&quot;array&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/content/WikitextContent.php&quot;,&quot;line&quot;:331,&quot;function&quot;:&quot;parse&quot;,&quot;class&quot;:&quot;StubObject&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;string&quot;,&quot;Title&quot;,&quot;ParserOptions&quot;,&quot;boolean&quot;,&quot;boolean&quot;,&quot;integer&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/content/AbstractContent.php&quot;,&quot;line&quot;:497,&quot;function&quot;:&quot;fillParserOutput&quot;,&quot;class&quot;:&quot;WikitextContent&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;Title&quot;,&quot;integer&quot;,&quot;ParserOptions&quot;,&quot;boolean&quot;,&quot;ParserOutput&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/poolcounter/PoolWorkArticleView.php&quot;,&quot;line&quot;:140,&quot;function&quot;:&quot;getParserOutput&quot;,&quot;class&quot;:&quot;AbstractContent&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;Title&quot;,&quot;integer&quot;,&quot;ParserOptions&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/poolcounter/PoolCounterWork.php&quot;,&quot;line&quot;:123,&quot;function&quot;:&quot;doWork&quot;,&quot;class&quot;:&quot;PoolWorkArticleView&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[]},{&quot;file&quot;:&quot;/var/www/html/w/includes/page/Article.php&quot;,&quot;line&quot;:676,&quot;function&quot;:&quot;execute&quot;,&quot;class&quot;:&quot;PoolCounterWork&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[]},{&quot;file&quot;:&quot;/var/www/html/w/includes/actions/ViewAction.php&quot;,&quot;line&quot;:44,&quot;function&quot;:&quot;view&quot;,&quot;class&quot;:&quot;Article&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[]},{&quot;file&quot;:&quot;/var/www/html/w/includes/MediaWiki.php&quot;,&quot;line&quot;:456,&quot;function&quot;:&quot;show&quot;,&quot;class&quot;:&quot;ViewAction&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[]},{&quot;file&quot;:&quot;/var/www/html/w/includes/MediaWiki.php&quot;,&quot;line&quot;:255,&quot;function&quot;:&quot;performAction&quot;,&quot;class&quot;:&quot;MediaWiki&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[&quot;Article&quot;,&quot;Title&quot;]},{&quot;file&quot;:&quot;/var/www/html/w/includes/MediaWiki.php&quot;,&quot;line&quot;:677,&quot;function&quot;:&quot;performRequest&quot;,&quot;class&quot;:&quot;MediaWiki&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[]},{&quot;file&quot;:&quot;/var/www/html/w/includes/MediaWiki.php&quot;,&quot;line&quot;:474,&quot;function&quot;:&quot;main&quot;,&quot;class&quot;:&quot;MediaWiki&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[]},{&quot;file&quot;:&quot;/var/www/html/w/index.php&quot;,&quot;line&quot;:41,&quot;function&quot;:&quot;run&quot;,&quot;class&quot;:&quot;MediaWiki&quot;,&quot;type&quot;:&quot;-&gt;&quot;,&quot;args&quot;:[]}]} [warning] Failed to invoke Pygments. Please check that Pygments is installed and that $wgPygmentizePath is accurate. [Called from SyntaxHighlight_GeSHi::highlight in /var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php at line 2
 * Hmm, this talk page appears to be abandoned by developers. I presume that going Phabricator with this issue draws more attention. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 17:26, 17 August 2015 (UTC)
 * Good idea. T110079 Ckoerner (talk) 17:56, 24 August 2015 (UTC)

lang="oz" ?
Hi, in the list of "Previously supported lexers", "oz" has no strike-through, but it doesn't seem to be supported by Pygments (see fr:Oz (langage)). --NicoV (talk) 12:23, 8 September 2015 (UTC)

ignore line attribute when attribute "line" set to "off"
motivation: I would like to create a template that (among other things) calls syntaxhighlight via parser function.

unfortunately neither {{#tag:syntaxhighlight|{{{code|{{{2}}}}}}|lang="{{{lang|{{{1|text}}}}}}"|start="{{{start|1}}}"|highlight="{{{highlight|}}}"|{{#if:{{{line|}}}|line=1}} nor {{#tag:syntaxhighlight|{{{code|{{{2}}}}}}|lang="{{{lang|{{{1|text}}}}}}"|start="{{{start|1}}}"|highlight="{{{highlight|}}}"{{#if:{{{line|}}}|{{!}}line=1}} works. with both examples, you cannot activate line numbering.

My only solution so far is to patch the extension [0], then somthing like this works perfect: {{#tag:syntaxhighlight|{{{code|{{{2}}}}}}|lang="{{{lang|{{{1|text}}}}}}"|start="{{{start|1}}}"|highlight="{{{highlight|}}}"|line="{{{line|on}}}"}}

So my request: Does anyone have a solution to the problem? Otherwise, would it be possible, to make a small change to the extension to allow for setting the "line" attribute but ignoring it nonetheless?

[0] my so called patch to

regards, Tobias Tobias Oetterer (talk) 15:11, 2 October 2015 (UTC)

Does not work for languages with code containing dash
For example:

In mine MW it looks like this: But if I choose any other language without dash in code ( for example), it works fine:
 * http://i.imgur.com/ZTypKUc.png
 * http://i.imgur.com/4e9ygoH.png

It happened after updating MW from 1.21 to 1.25.

I tried to update, but it didn't help.

Abagnale OS Ubuntu 14.04.2 LTS; MW 1.25.3; MySQL 5.5.43; PHP 5.5.9 19:50, 11 November 2015 (UTC)

Installed from git and I get a bad lang attribute
Bad lang attribute just like on the mediawiki page. I'm using languages like bash and javascript. Unsure of what I'm doing wrong??


 * If you downloaded SyntaxHighlight GeSHi from Git, you will have to do a composer install (or was it composer update?) in the extension folder in order to get the dependencies. --88.130.109.128 01:44, 26 November 2015 (UTC)


 * Thanks. I've cloned a fresh git repo and then composer update and it solved it:
 * --Ioannis Protonotarios 07:59, 30 December 2015 (UTC)
 * --Ioannis Protonotarios 07:59, 30 December 2015 (UTC)

Hightlighting for templates and wiki
How to enable highlight in quoted code of templates (ParserFunctions), when quoting it in wikipedia? And also of wikicode (brackets –  )? Example:


 * What you're asking for is wikitext support. I quote from Extension:SyntaxHighlight_GeSHi:


 * "Pygments does not yet provide a "wikitext" or "mediawiki" lexer. Use "html" instead. (see: T29828)"


 * --Ioannis Protonotarios 07:29, 30 December 2015 (UTC)

Invoke pygmentize on Windows machines
SyntaxHighlight_GeSHi will not work on Windows machines, because Windows doesn't know, that it has to use Python for the pygmentize package. So you have to rename pygmentize to pygmentize.py and to set the $wgPygmentizePath Variable in your LocalSettings.php. In my opinion it should not be to hard to solve this inconvenience in the next revision.

There's also a problem described in http://stackoverflow.com/questions/28398163/laravel-symfony-process-component-fails-to-start-new-process which I encountered on my Windows 7 x64 machine. Shortly, Symfony\Process doesn't start python (or any other) process correctly nor reads any results of the pygmentize package. My simple workaround was to get rid of the Symfony\Process component in the implementation of the highlight function in extensions\SyntaxHighlight_GeSHi\SyntaxHighlight_GeSHi.php file, and replace it by calls to PHP IO functions. The code is below (see the part which is commented out). Any better solution would be highly appreciated.