Extension talk:SyntaxHighlight GeSHi/Archive 2008

== Syntax highlighting tags themselves?

I need to highlight the following snippet of XML code, but the embedded tag indicates that syntax highlighting should end. Encoding the tag (for ex: &lt;/source>) won't work either, since this is interpreted literally (ex: translated to &amp;lt;).

--Shelley 17:01, 22 January 2008 (UTC)


 * I edited your example above by adding zero width space between  and  . One way to do it is to type something like   in wikitext, click "Show preview", copy the result from preview into wikitext and then remove exclamation signs. This worked in Firefox 1.5. You can "feel" this symbol in your example above if you move the text cursor through the   word. P.S. There still might be a better way to do it ∴ AlexSm 17:52, 22 January 2008 (UTC)
 * While the result looks fine in Firefox and Opera, unfortunately IE (at least IE6) actually displays this Unicode character, so I guess this wasn't a good solution :( ∴ AlexSm 17:56, 22 January 2008 (UTC)
 * Thanks for the idea. This enables the appropriate formatting in the browser (at least Firefox2 & IE7), but unfortunately, I would like to be able to enable copy-and-paste of the source for reuse outside of the browser. When copying this text, the white space character is also copied (which, in the case above, results in invalid XML). Any other ideas would be appreciated! --Shelley 17:01, 23 January 2008 (UTC)

Update: I just found out that #tag magic word is supposed to help you, used somewhat like this:. I couldn't get it to work though, you might have better luck. Look for #tag at Magic words, note that it seems it also depends on the new parser (now enabled on en.wp and test.wp), and you can also try to experiment in Special:ExpandTemplates ∴ AlexSm 19:06, 6 February 2008 (UTC)

Line numbers and formatting
I just installed this extension and it works fine. I noticed, however, that if I add the "line" argument to the. The problem is that I don't know where I have to put it.

Another question, although I'm setting the key 'line' to true in the array  inside SyntaxHighlight_GeSHi, line numbers doesn't seem to apper. Does anyone know why ?

If someone can help me with this I'll be very grateful :)

(sorry about my English :P ) -IP 28 January 2008

haskell support
The svn-repository for GeSHi doesn't include support for haskell, however, the latest release (download here) includes that file (and it works fine in my wiki, see here). As far as I can tell, Haskell is the only language that is not included in the svn-repo, so you might want to add a note? -- Mati 13:48, 30 January 2008 (UTC)


 * An update was requested with Bug 10967 (2007-08-17). Raymond 18:48, 31 January 2008 (UTC)

Empty delimiter errors
I am using this extension on the OpenOffice.org wiki, and everywhere we are using the oobas lang, we are getting loads of "Empty Delimiter" errors:

Warning: stristr [function.stristr]: Empty delimiter. in space/mediawiki-1.11.0/extensions/SyntaxHighlight_GeSHi/geshi/geshi.php on line 2127

An example on the live wiki... http://wiki.services.openoffice.org/wiki/UNO_registery_and_Bootstrapping

This only seems to happen with lang=oobas. What can I do to fix this other than going through thousands of Wiki pages and changing lang=oobas to something else? --Ccornell 09:13, 13 March 2008 (UTC)
 * The mystery deepens.... sometimes the error shows, and other times, the page looks perfect, with no edits between a broken page display and a correct page display. Any assistance with tracking this error down would be appreciated. --Ccornell 12:39, 13 March 2008 (UTC)
 * The bug is related to an error in the oobas language file. After the keyword 'mod' there's an empty keyword specified, that causes the trouble. Fixed in next stable. Feel free to report such bugs to the official GeSHi tracker at SourceForge --217.93.203.194 11:39, 26 April 2008 (UTC)
 * The fix works. Any further problems I'll report in the GeSHi Tracker. --Ccornell 11:28, 28 April 2008 (UTC)

&lt;source&gt; in a List
I want to put a &lt;source&gt; in a ListEntry (* ...) and below a ListEntry (: ...). So that the source-Block doesn't start at the beginnig at the line. How to do that? 217.91.56.172 15:44, 1 April 2008 (UTC)

Memory usage huge?
I was happy of the extension until... I tried a source lang=diff of 2300 lines and it died after having exhausted the available memory (told me about failed allocation of 135Mb of RAM) and a source lang=diff of 520 lines, when saving the page the display page died with a "script didn't return after 30s"

2300 lines is big, ok, but does it justify 135Mb of RAM?? --IP 2 April 2008

Last version from SVN does not work with MediaWiki 1.10
The current head version of SyntaxHighlight_GeSHi.class.php use the function "wfLoadExtensionMessages" that is introduce in 1.11. You have to use previous SVN revision (28481) to get this extention working with mediawiki 1.10.x. --62.147.241.233 12:28, 3 April 2008 (UTC)


 * Alternatively, you could apply the following patch:
 * In the file, before the defintion of the function  , add the following function:


 * Then, in the same file, in the function, replace the call   by the following:


 * And lo and behold, things work again...
 * Cheers! Lexw 09:02, 27 May 2008 (UTC)

Latest GeSHi: Don't link against trunk!
Although http://geshi.svn.sourceforge.net/svnroot/geshi/trunk/geshi-1.0.X/src/ is reasonably stable most of the time it may or may not work properly at all times. Please use http://geshi.svn.sourceforge.net/svnroot/geshi/branches/RELEASE_1_0_7_STABLE/geshi-1.0.X/src/ instead as this will only get patches that will end up in the release and thus will always include a running version of GeSHi.

Side note: After checking out to src you simply can do a instead of softlinking\hardlinking those two directories. This will save you some trouble as Apache sometimes causes problems with stuff being crosslinked in the filesystem.

--BenBE 12:00, 26 April 2008 (UTC)

converted in &amp;lt; and &amp;gt; and not shown properly.
Hi, I'm trying to highlight some XML but the result is very hard to read.

see for example www.wikijava.org/wiki/Sibling_Check_in_XSLT

Any idea how to show this properly? I've thanks, --DonGiulio 20:49, 1 May 2008 (UTC)
 * geshi 1.0.7.21
 * SyntaxHighlight GeSHi r24298 (July 21, 2007)


 * That's at least not the fault of GeSHi, but seems a problem that somehow escaped HTML is passed to GeSHi. Please make sure that only unescaped HTML get's passed.
 * Maybe you should try updating the SyntaxHighlight_GeSHi extension to a more recent revision.
 * --BenBE 11:13, 2 May 2008 (UTC)


 * I just uploaded the SVN version of the extension. and I still get the issue. I believe that it is caused from the fact that source is called using a template. having a better look on the page I realized that in the page (www.wikijava.org/wiki/Sibling_Check_in_XSLT) some "less than" are corrected some other no, in particular the broken ones are generated using the template. How could I solve that?
 * Thank you very much,
 * --DonGiulio 12:18, 2 May 2008 (UTC)


 * I believe the problem is caused by the tag extension. Using the tag #tag that was needed for proper conversion of the template attribute into its value. I don't know what would be best, if to fix the tag extension or the geshi highlight in order to fix this problem. Maybe a different extension would fix the problem? Does anyone have experience about it?
 * thanks --DonGiulio 00:59, 10 May 2008 (UTC)


 * As mentioned before: It's not a bug in GeSHi, but in one of the extensions you use. Crap in --> Crap out. --BenBE 12:11, 10 May 2008 (UTC)

Adding a general style
Something I've hacked into my local copy of this is adding the class "highlighted-source" to the div enclosing the output from geshi. This allows me to have a format for all source code styles, whether they include line numbers or not. This seems like a good thing to add to the base code. Haarg 22:49, 9 May 2008 (UTC)


 * It's already there. Just use set_overall_class, set_overall_id or set_overall_style ... --BenBE 12:09, 10 May 2008 (UTC)


 * Of course you can do anything you want if you modify the extension code. The point of the modification though is to simplify formatting code blocks using MediaWiki:Common.css or MediaWiki:Geshi.css.  I've already made the changes needed for me, but I think they would be useful to others using this extension.  I initially tried to use set_overall_class to do what I wanted, but couldn't see any way to have it use multiple classes (highlighted-source and source-$lang). — Haarg 01:21, 11 May 2008 (UTC)


 * IIRC classes in CSS are separated by using spaces. thus you'd probably use class="class1 class2" for two classes (Unchecked, but if I remember the CSS specs right, should do). Have a look at http://www.frontpagewebmaster.com/m-134791/tm.htm for some details on multiple CSS classes for one element. --BenBE 16:13, 12 May 2008 (UTC)


 * They are separated with spaces in HTML, but not in CSS. geshi uses the classes given for both the HTML and the CSS it generates, and isn't expecting multiple classes.  Giving it 'highlighted-source source-$lang' would result in invalid CSS.  The output from geshi is already being wrapped in a div, so the simplest thing is to just add a class to that div. — Haarg 09:41, 13 May 2008 (UTC)

Delphi Syntax Highlighting
Please add two keywords into Delphi programming language highlighting scheme: --Arseniy.bocharov 07:24, 22 May 2008 (UTC)
 * Actually this is an issue with GeSHi, not this plugin. I added the suggested ones (and some other ones I just happened to come accross. Feel free to report other missing keywords directly to the developement page of GeSHi at SourceForge.net. --BenBE 23:00, 25 May 2008 (UTC)

Bash problem
I have a weird problem highlighting bash source code with this extension. When I try to highlight this one:

echo "$(date +%c) :: $LOADAVERAGE :: $CPULAST" >> ${LOGFILE}; echo "$(date +%c) :: $LOADAVERAGE :: $CPULAST" >> ${LOGFILE_ALL};

it turns into this (note the pipe symbols "|"):



My installation of Serendipity using GeSHi as well, on the other hand, does it do the right way:



I thought it was a problem with this extension, but then I realized that this installation here on mw.org does it do correctly, as well:

Any clues? Thanks in advance, --Flominator 09:29, 28 May 2008 (UTC)

PS: My configuration is noted at Image:Geshi mediawiki.png, I use r35333 of this extension.


 * There has been added a feature recently that highlights symbols in the source. As this feature partly overrides already highlighted regular expressions there will be an addition soon, coming with GeSHi release 1.0.7.22. (There also the mentioned behaviour is fixed again). --BenBE 19:13, 1 June 2008 (UTC)

GeSHi background problem
I'm using this extension on a wiki of mine, and I ran into a problem: when using the &lt;source&gt; tags, I can't figure how to have the gray canvas background that is there normally. I've already asked for help on MWUsers.com, to no avail. If I'm not explaning this well, I have an example set up here. The first example isn't using GeSHi, and it has the canvas background. The second one does use it and, while the spaces are there, no background shows up. I haven't made any chances to the code, though I have added one additional language file.

Also, while I'm here, is there any way to have this highlight something inside a string? This language has embedded expressions in strings (if you don't know what that is, look below, as I don't know how many languages even use these) and I'd like to have them highlighted so their more visible. For example: In that code, I would like the "[bloop]" bit to be a different color.

Any help on either of these would be much appreciated!

24.145.19.247 00:37, 14 August 2008 (UTC)


 * The feature regarding highlighting special bits inside a string is not yet supported in the form you are trying to use it, but I was thinking about about implementing something like this in some upcoming version of GeSHi, although this might still take some time. You'll find a not on the GeSHi changelog as son as it is implemented. --BenBE 21:18, 16 August 2008 (UTC)
 * Preliminary support for Escape Regexps has just been committed to trunk in Revision r1772-r1774. See the PHP language file for details on usage. Please report any bugs regarding this feature to the GeSHi-devel mailing list. --BenBE 00:22, 17 August 2008 (UTC)
 * Okay, sorry for sounding like a complete idiot, but where is that? I looked at the few places I can think of and I can't find it. =/ 24.145.19.247 09:07, 23 August 2008 (UTC)
 * Checkout http://geshi.svn.sourceforge.net/svnroot/geshi/trunk/geshi-1.0.X/src/ with an SVN client (just as said on the main page) and look into geshi/php.php for an example. --BenBE 12:28, 25 August 2008 (UTC)