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.

=2011=

Border around every line when line numbers are displayed
I installed rev:50696 on MediaWiki 1.16. I followed the discussion in the 2008 archives about editing the SyntaxHighlight_GeSHi.class.php and the main.css files in order to display the usual  border and background. When I display code using the tool with only the language specification, everything works fine. But when I ask for the line numbers to be displayed, there is a border around every line, which is really ugly. Here is a printscreen of my wiki :



Any idea on how to fix this? Thanks! -- Nouklea

1.0em/1.2em
The plugin for v1.16, r62591 uses aforementioned notation. Which is a rather obscure way to say "1em font-size and 1.2em line-height, please". Sadly, this fails in both FF4 and Safari 5 (which seem to consider it a division). I recommend against using it. 217.6.212.138 13:14, 20 May 2011 (UTC)

Change background color
I wanted to be able to change the background color of the highlighted code, so I took the liberty of adding the functionality. Here's the patch to apply to SyntaxHighlight_GeSHi.class.php

24a25,26 > 		static $codeAreaNumber = 0; > 		$codeAreaNumber += 1; 57a60,66 > 		// Background colors > 		if( isset( $args['backgroundcolor'] ) && $args['backgroundcolor'] ) { > 			$backgroundcolor = $args['backgroundcolor']; > 			$geshi->set_overall_style('background-color: '.$backgroundcolor, true); > 		} > 		$geshi->set_overall_id( 'codeArea'.$codeAreaNumber ); > 			 91c100 < 		$parser->mOutput->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}" ); --- > 		$parser->mOutput->addHeadItem( self::buildHeadItem( $geshi ), "source-{$lang}-{$codeAreaNumber}" ); 363c372 < } \ No newline at end of file --- > }

If I could find information on the maintainer of this project, I'd be happy to send the patch in. After applying the patch you can then do the following:

and your code would be syntax highlighted and have the specified background color


 * unfortunately this causes problems when you have a padded code box. you need to include in the script to colorize the entire code box 167.230.104.94 07:35, 22 September 2011 (UTC)

How to enable download of the embedded code
I extended SyntaxHighlight GeSHi so that each code fragment can be given a button to download it as a file. You can see an example on page http://freeplane.sourceforge.net/wiki/index.php/Scripting:_Example_scripts (actually this page uses an older extension GeSHiHighlight but the idea is basically the same).

Following modifications are required:

file  with following content should be uploaded into extensions/SyntaxHighlight_GeSHi

function  in file   is modified near the end. is replaced by     EOFORM; $out = $form.$out; }	wfProfileOut( __METHOD__ ); return $out; DimitryPolivaev 21:41, 5 January 2011 (UTC)

Language
I'm disappointed MW Syntax isn't an option. Really disappointed. --67.124.37.29 20:49, 26 September 2011 (UTC)
 * The Geshi language files are easy to write - I wrote SPARQL syntax and it takes me 1 hour. If you'll write MW syntax don't forget to share it!!--Katkov Yury 12:27, 28 October 2011 (UTC)