Extension talk:SyntaxHighlight GeSHi/Archive 2015

Please do not make requests for support for languages or bug reports for highlighting errors on this page. This extension uses the GeSHi library, which is not maintained by the MediaWiki developers. Bug reports and feature requests for the highlighting should be made to the GeSHi developers.

=2010=

Parsing hiccup for Ruby
I think the Ruby syntax highlighting of the current GeSHI version is incorrect when highlighting here documents: Correct me if I'm wrong: I think everything between the delimiting identifier should all be in string literal color. I won't enter this as a bug to bugzilla myself. Thanks, --Abdull 23:26, 27 January 2010 (UTC)
 * Fixed in upstream. And be happy I checked here. Bugs and Feature Requests that affect the language files ALWAYS should be reported upstream. --BenBE 12:30, 2 May 2010 (UTC)

Which version of GeSHi is installed?
I didn't see "R" as one of the languages recognized, and I recently read that version 1.0.8.6 will parse "R" code. -- Avi 03:43, 25 February 2010 (UTC)
 * ping. -- Avi 16:56, 17 March 2010 (UTC)
 * In case they update 1.0.8.8 would be a good starting point. --BenBE 12:31, 2 May 2010 (UTC)

Line Wrap does not work
I tried every line parameter, but Line Wrap does not work. Any suggestions? --Laquestianne 16:08, 4 March 2010 (UTC)

Try enclose="div" --62.161.120.3 10:22, 13 July 2010 (UTC)

Make line numbers show by default
Does anyone know how to make the code show line numbers by default? I know from the documentation that I should use this source:

But I'm not sure where to place it.

--Weirdy12 19:40, 4 March 2010 (UTC)

Support for JSON format
It would be nice if you can integrate support for JSON format? Currently you can use "text" as source, but then a JSON array fills the whole line.

217.111.18.215 16:09, 17 March 2010 (UTC)


 * Wouldn't you just use "javascript" ? --98.204.58.109 07:30, 23 March 2010 (UTC)

Default pre style, revisited
I didn't like the suggested CSS fix to add back the border around pre format, because it also adds a border around div format. The following rule variation adds the border only for pre, allowing you to avoid the border by using enclose="div". A disadvantage though is that it doesn't add the border for numbered pre listings. .mw-geshi > div[class] > pre.de1 { padding: 1em; margin: 1em 0; border: 1px dashed #2F6FAB; } —GregU, 23 March 2010

Issue with Unicode Highlighting in XML (Strict Block Detection)
The following has an issue:

I don't think it's handling Unicode characters too well! - Tbsdy lives 00:47, 26 April 2010 (UTC)
 * Thanks for the note. I had a look at the example and could reproduce it locally, but IDK when I'll get around to fix this. --BenBE 12:37, 2 May 2010 (UTC)

CSS changes in new default template
The code markup displayed with the new default template looks ugly. In particular, it significantly changes the previous font-size, breaking the layout of many pages.

Compare for example:

http://fr.wikipedia.org/wiki/XeTeX#Exemple (using the old template and CSS)

with:

http://en.wikipedia.org/wiki/XeTeX#Example (uding the new template and CSS)

is there a way to override the style settings for an individual code block? --90.193.89.221 20:58, 6 June 2010 (UTC)


 * If you want to bypass the grey background and related formatting set from Geshi.css at en.wikipedia you can try adding enclose="none" to the GeSHi tag to disable the div on which the formatting is applied. Due to this annoying bug involving enclose="none" I tried to figure out a better hack that actually allowed to override the CSS, but up to now I had no success - neither at HTML/markup level nor at user CSS level. --Duplode 04:12, 10 June 2010 (UTC)

Special:Version Broken
Since installing the plugin, the Mediawiki page Special:Version has been broken. It throws up this error:

Fatal error: Cannot redeclare class GeSHi in /glide/apache/www/wikiuat/extensions/SyntaxHighlight_GeSHi/geshi/geshi.php on line 255 Guy.yedwab 14:34, 1 July 2010 (UTC)

Enable use within templates
Currently, you can't use wikitext inside of a

That block is right before the line

So far, so good. I've looked at $IP/includes/parser/Parser.php and the methods it makes available. I've tried using them on the $parser variable passed in to parserHook, I've tried initializing my own. Nothing I do seems to be right. Either I get no effect, the page comes back completely empty, or virtually everything gets prefixed by UNIQ...QINU, so clearly everything is going haywire.

I've spent all the time I can afford trying to spend trying to make this work. Can someone tell me what I need to insert inside that IF block that will cause the contents of $text to be converted to the value of the variable?

The line to enclose it all
Wanted to know how to do the line around the code like how they have it for code examples at the following page. see this page. Can anybody point me to the script they used? Gman124 16:17, 13 July 2010 (UTC)

A bizarre bug involving REGEXPS
I'm writing a highlighter for a language I'm working on, and anytime I try and define a regex expressions for REGEXPS it causes a strange bug for the syntax highlighter. This doesn't happen if I use the "simple" format specified in the documentation. It's the "advanced" that causes the bug. I've set up an example of the way it should look here, and the bugged version is here. The current source code is here. If anyone could provide some help, it would be much appreciated. 108.1.245.194 03:00, 29 July 2010 (UTC)

Read source from a URL
This is a new feature request.

I'd like to use the syntax highlight

You may assume the url does not require authentication.

The link=true attribute would add an external URL link to the actual URL (after the source); it is convenient but but is not necessary.

--DavidBiesack 13:58, 6 August 2010 (UTC)

Automatic Syntax Highlight By Page Title
Here's some useful code so that a page that ends with, for instance, .py, it will be automatically highlighted as python code. Dunno why this hasn't been done before. It's not too hard:

/**	 * Hook into Article::view to provide syntax highlighting for * pages that end with common source-code extensions */	public static function viewHook( $parser, $text ) { global $wgSyntaxExtensions; //Check if title or not $title = $parser->getTitle; $article = new Article($title); if ($article->getContent != $text) { return false; } // Determine the language if ( preg_match( '!\.('.implode('|',$wgSyntaxExtensions).')$!u', $title, $matches ) ) { $lang = $matches[1]; if ( $lang == 'txt' ) { $lang = 'text'; } if ( $lang == 'py' ) { $lang = 'python'; } if ( $lang == 'f90' ) { $lang = 'text'; } if ( $lang == 'sh' ) { $lang = 'bash'; } if ( $lang == 'js' ) { $lang = 'javascript'; } $text = str_replace(' ';		}

static $hasRun = false; if ($hasRun) return true; $hasRun = true;

return true; }

and

$wgHooks['ParserBeforeStrip'][] = 'SyntaxHighlight_GeSHi::viewHook';

Cheers, Douglas