Extension talk:SyntaxHighlight GeSHi/Archive 2015

The download link doesn't exist. IS this the correct link? http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SyntaxHighlight_GeSHi/ 21:01, 4 April 2007 (UTC)


 * It was renamed a few days ago, thanks for catching this. -- Duesentrieb ⇌ 23:58, 4 April 2007 (UTC)

Installation
The text states that geshi.php is created, but the require once code talks about SyntaxHighlight_GeSHi.php, should that be geshi.php in the require once? --12.148.245.61 14:26, 19 September 2007 (UTC)

me2
Fatal error: Call to undefined method ParserOutput::addHeadItem in ...\wiki\extensions\SyntaxHighlight\SyntaxHighlight_GeSHi.php on line 113

I'm work with windows apache2 & php5, and i have already tried to take some older versions, but nothing changed.

I think ParserOutput::addHeadItem was added quite recently - so the current version of this extension only works with the current development trunk. You will have to use an older version with MW 1.9. -- Duesentrieb ⇌ 11:25, 5 April 2007 (UTC)

Yea, try this version: -- Duesentrieb ⇌ 11:28, 5 April 2007 (UTC)

DSig
I originally downloaded the current version of SyntaxHighlight_GeSHi.php pointed at by the article. I put the php into the extensions directory. I unziped the current GeSHi. it created a GeSHI-1.0.7.19 directory with geshi directory inside of it. I then moved the geSHi directory into the extensions directory.

so we have

extenstions (dir) SyntaxhHighlight_GeSHi.php geshi (dir) (everything under geshi)

I modified the localsettings.php to point to the correct location require_once("extensions/SyntaxHighlight_GeSHi.php");

I got a couple of errors on require so using echo i worked out directories but then i get

Fatal error: Call to undefined function efSyntaxHighlightMessages in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\wikiSanMar\extensions\SyntaxHighlight_GeSHi.php on line 65

I have tried both the originally posted code and then the older code noted above.

Ideas? I am sure it is something to do with where I have located it all as I doubt that this would have been posted without it working. SO fire away .. where have I gone all wrong

Thanks

213.186.1.162 10:47, 13 April 2007 (UTC) Try changing efSyntaxHighlightMessages to efSyntaxHighlight_GeSHiMessages. Worked for us!


 * This worked great .. thanks --Dtsig 19:02, 24 April 2007 (UTC)

I gave up
For those that just want highlighting without jumping through hoops, I ended up using this GeSHi extension on my 1.7+ wiki:

GeSHiHighlight.php

Has there been a resolution to this yet?
I was having the same issue as above:

Fatal error: Call to undefined method ParserOutput::addHeadItem in ...\wiki\extensions\SyntaxHighlight\SyntaxHighlight_GeSHi.php on line 113

Attempted this:

Yea, try this version: -- Duesentrieb ⇌ 11:28, 5 April 2007 (UTC)

which led to:

PHP Fatal error: require_once [function.require]: Failed opening required '/var/www/html/devwiki/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight.i18n.php' (include_path='/var/www/html/devwiki:/var/www/html/devwiki/includes:/var/www/html/devwiki/languages:.:/usr/share/pear') in /var/www/html/devwiki/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php on line 59

Is there any updates on this or am I going to have to use a different extension for this?

remember to download all the files here >>> http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SyntaxHighlight_GeSHi/

One Solution
You need to rename the file "SyntaxHighlight.i18n.php" to "SyntaxHighlight_GeSHi.i18n.php"

Then inside either file make sure the names:

"efSyntaxHighlightMessages"

"efSyntaxHighlight_GeSHiMessages" Match, puick one, and rename it and your away, not sure what version we arep laying with here but its now working for me, all I care about.

Yes, It works for me
Thank you,who written the message above. The steps are followed

In SyntaxHighlight_GeSHi.php

First,rename the file "SyntaxHighlight.i18n.php" to "SyntaxHighlight_GeSHi.i18n.php"

Second, find this require_once( dirname( __FILE__ ) . '/SyntaxHighlight.i18n.php' ); change to require_once( dirname( __FILE__ ) . '/SyntaxHighlight_GeSHi.i18n.php' );
 * and find this

foreach( efSyntaxHighlightMessages as $lang => $messages ) change to foreach( efSyntaxHighlight_GeSHiMessages as $lang => $messages )

--Roc michael 03:54, 30 June 2007 (UTC)
 * Mediawiki 1.9.2
 * The AppServ Open Project - 2.5.7 for Windows
 * Apache Web Server Version 2.2.3
 * PHP Script Language Version 5.1.6
 * MySQL Database Version 5.0.24a
 * phpMyAdmin Database Manager Version 2.9.0.2

What about further version of mediawiki?
I try it with 1.9.3 and the latest highlight-files and get an error which look similar: "Fatal error: Call to undefined method ParserOutput::addHeadItem in /opt/lampp/htdocs/labbook/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php on line 127"

Why it is so sensitive to the used version.

What is the alternative extension, to highlight bash and perl, which is more stable?

Inline usage
Is there a way to highlight a small piece of code inline, i.e. make &lt;source> into &lt;span>? I tried enclose=none but it doesn't work (while enclose=div does work) -- Alex Smotrov 16:54, 21 May 2007 (UTC)

References use in comments
hi,

It seems we can't use the tag in comments. (sorry for my really poor english). 82.226.213.114 00:57, 29 May 2007 (UTC)

solution for me
Replaced the $parser->mOutput->addHeadItem( ... )-Code with:

$out = "/*<![CDATA[*/\n". ".source-$lang {line-height: normal;}\n". ".source-$lang li {line-height: normal;}\n". $geshi->get_stylesheet( false ). "/*]]>*/ \n$sitecss".$out;

It is very VERY ugly and not valid, but FF2 and IE7 seem to show it properly.

1.9.3 and character parsing in SyntaxHighlight
This works great with the following exception.

Characters like < > get changed to their html equiv &lt etc

These characters are *kind of* important in source :)

I would have thought that this extension should bypass wiki/html parsing .. yes? As we see above a PRE protects the angle brackets .. shouldn't source

fyi .. This same behavior is found in 1.10.0 ..

Has anyone else seen this? Thanks --Dtsig 15:20, 5 June 2007 (UTC)


 * If you allow stuff like <> then you open a big hole for things like javascript ....
 * And what's possible with javascript is (do say it frendly) not nice (phising, steal passwords ...).
 * If you need the "nacked" code use &action=raw&ctype=text/javascript&dontcountme=s example:
 * Anyway: I don't see you're problem, because with copy&past "highlighted" sources work well.
 * -- MichaelFrey 15:42, 5 June 2007 (UTC)


 * '.. don't see you're problem .. ' I am not sure what you are saying here. What source did you copy&paste?   The fact that a < becomes &lt is a problem.  I will look at the link you posted. --208.214.103.202 20:30, 5 June 2007 (UTC)
 * hmmm german .. sorry I do not understand it. --Dtsig 20:33, 5 June 2007 (UTC)


 * Why or when is the &lt a problem for you?
 * I mean all actual Browsers like FF 2.0 and IE 7.0 render the source code correct.
 * You say, "PRE protects the angle brackets" but when I look at into the HTML source of that talk page, I see also the html equivalents of.
 * Anyway, sorry that my link was wrong, her 2 correct exampels:
 * Again: If the extension bypass things like < > it is a hole for Cross-site scripting and similar things.
 * -- MichaelFrey 15:44, 6 June 2007 (UTC)

Language which doesn't work yet
Hi,

I participate in writing the Wikibook about Haskell.

GeSHi doesn't support Haskell yet, but it might in the near future (see the feature request).

In the meantime, if i try to write  or something else.

Is it possible to modify this extension for that?

If this is not the right place to propose it, please tell me what is the right place.

Thanks in advance. --Amir E. Aharoni 16:55, 8 June 2007 (UTC)


 * I entered a feature request in Bugzilla: 10201 Allow showing code in an unsupported language with a warning. Come on and vote for it if you like it :) --Amir E. Aharoni 18:27, 8 June 2007 (UTC)


 * It should be supported in GeSHi 1.0.7.20. Can we have that updated here please? 62.181.57.12 04:37, 21 August 2007 (UTC)

Undefined method addHeadItem
I just tried installing this extension, and I'm pretty sure I followed the directions exactly, but I'm getting the error:

[04-Apr-2007 21:01:29] PHP Fatal error: Call to undefined method ParserOutput::addHeadItem in ...\extensions\SyntaxHighlight_GeSHi\SyntaxHighlight_GeSHi.php on line 113

--159.140.254.10 02:09, 5 April 2007 (UTC)


 * yes, I'm getting this one to – just that now it's line 144. Might it be that the PHP version is not sufficient? My PHP version is 4.4.4 - what is the minimum version required for SyntaxHighlight GeSHi? --Leo141 15:05, 29 June 2007 (UTC)
 * Oops, how could I oversee that there are some answers on this here ... The workaround at works for me too. --Leo141 17:08, 29 June 2007 (UTC)

Error when passing parameters from templates
As GeSHi doesn't have any functionality for in-line syntax highlighting yet, I figured I could create a template for that:

I'm a sys-op, so I can edit the CSS files and add the .inline_code class. But the GeSHi plugin complains about not getting a lang="" parameter.

My guess is that MW runs the stuff before it's passing the parameters from the template. Not sure at all, just guessing.

See the error and a brief explanation on http://no.wikibooks.org/wiki/Bruker:August/GeSHi_issues ( I tried no:wb:Bruker:August/GeSHi issues but that linked to wikipedia, not sure about the syntax).

Regards, August Lilleaas, sysop @ norwegian wikibooks.


 * Just made myself an account here, in case someone needs to contact me directly that's a bit more convenient now. --Leethal 12:39, 4 July 2007 (UTC)

I don't have an answer to your template parameter problem, but as for inline &lt;source>: So the only way so far I could make it inline requires putting the whole paragraph inside &lt;div>: div.inline_code * {display:inline} &lt;div class=inline_code> Your text &lt;source enclose=div lang=javascript>document.write&lt;/source> your text again &lt;/div> I think the better solution is to request inline source on bugzilla: Alex Smotrov 16:38, 5 July 2007 (UTC)
 * block elements are not supposed to be inside &lt;span>, so in html Mediawiki moves your &lt;span> inside &lt;pre>
 * Mediawiki encloses all text before and after block elements into &lt;p> tags
 * CSS:
 * wiki:

Graceful death?
When there are improper source tags the script generates a large error box, could you remove that. I should dispaly nothing if broken. see:
 * Without linenumbers

2. And could someone add Estonian translation, to SyntaxHighlight_GeSHi.i18n.php /* Estonian et:Kasutaja:M2s17 */ 'et' => array( 'syntaxhighlight-specify' => 'Sa pead täpsustama keelt nõnda:', 'syntaxhighlight-supported' => 'Süntaksi esiletoomise on toetatud järgnevates keeltes:', 'syntaxhighlight-err-loading' => '(toetatud keelte loetelu laadimisel esines viga)', 'syntaxhighlight-err-language' => 'antud keel on mittekehtiv', 'geshi.css' => '/* CSS mis on asetatud siia, määrab GeSHi süntaksi esiletoomise stiili */', ), --88.196.91.126 22:42, 20 July 2007 (UTC)


 * Localisation added in r24296, thanks. As to the first question, I'm not sure if I understand, but I'll give it a bash.


 * The question, as I understand it, is why everything looks a bit different when using line numbers. As you'll spot in the HTML source, when line numbers are in use, we have to use a &lt;div&gt;, rather than &lt;pre&gt;, which means that the grey background and dashed border don't show up. If you'd like this, then you can style the surrounding &lt;div&gt; elements to look the same, using some CSS in MediaWiki:Monobook.css:


 * Hope this helps. robchurch | talk 01:18, 21 July 2007 (UTC)

== internal links withing // Request WinSendMsg(hwndWnd,blabla...
 * }

Using messages hilighting and internal links may be greate thing for programmer's wiki --Evgen 11:56, 27 July 2007 (UTC)

Mediawiki markup
Can we work with the GeSHi developers and add our wiki markup to the supported languages? Then we can provide examples of our own code much more easily. 71.167.62.22 00:34, 10 August 2007 (UTC)

error after install
I have installed the GeSHi Syntax Highlighter,

now on save an edit i got the following Error:

Fatal error: Call to undefined method ParserOutput::addHeadItem in /var/www/slr_wiki/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php on line 66

Greetz Phillip

I need an old and stable version
Hello,

I need an OLD but STABLE version of this extension which works with these settings:

* MediaWiki: 1.6.7 * PHP: 4.3.10 (apache2handler) * MySQL: 4.1.10a

(I can't explain it, but) there is NO WAY to update one of these settings!!!!!!!

I did try to find the right extension-version by combining the information of the extension-page-history with the subversion repository but nearly gave it up.

Might this one be the right one for me? http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Highlight/?pathrev=19695

What about 20985? I can't evaluate the position :-(

Can someone help me?

Post-install PHP Warning: call_user_func_array
After installing (as per the main page), when I try to test by including a some source (for example by copying any of the sample code directly) I get nothing on the screen (e.g. it does not render at all, the wiki page just skipes that line). When checking /var/log/httpd/error_log I get something like:

PHP Warning: call_user_func_array [function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'SyntaxHighlight_GeSHi::parserHook' was given in /var/www/mediawiki/includes/Parser.php on line 436, referer:

Any suggestions would be greatly appreciated. --M0nstr42 16:51, 22 August 2007 (UTC)

I am having the same issue. --Snapper67 11:09, 5 September 2007 (UTC)

Change the background color?
Is there a way to change the background of the rendered code table? I know that I can change it in the lang.php file but I'd expect there is a way to have a default background shared by all. I noticed that it creates a css class called "source-lang". Should I just create one myself in my wiki css file (I suppose there is one, somewhere :D) or is there some magic parameter that I can set? Thanks! -Adal
 * If you can do it by altering the CSS class, you might find this extension useful, which allows a parser function to dynamically load a css article that is on the wiki rather than a css hardcoded into the mediawiki filesystem --Zven 23:45, 28 August 2007 (UTC)
 * I now remember putting some notes up on bioperl wiki which are useful aswell --Zven 04:27, 29 August 2007 (UTC)

Upgrading to 1.11.rc1
Hi, after updating to MW 1.11.rc1 i get the following error.

'''Detected bug in an extension! Hook syntaxHighlightLoadMessages failed to return a value; should return true to continue hook processing or false to abort.'''

The top of the code box is getting chopped off in IE
I just installed this extension on my site, and it looks great in Firefox, but in IE the top of the code box is getting chopped off. The code is formatted correctly, but the first few lines don't have the background box, and the top border is missing. I checked your site as well, and I get the same behavior -- looks great in FF, not so much in IE. As much as I'd love to tell everyone to use FF, my site is a corporate site where IE is the standard. Any ideas? Thanks --ColinLittle 20:33, 28 September 2007 (UTC)
 * This is apparently not a problem in IE7. I'm using IE6 -- ColinLittle 21:15, 28 September 2007 (UTC)

Doesn't work on 1.9.2
I tried and tried to get this one to work on my wiki. I have installed several extensions and am not new to this, but I could not make this work. I even tried using some of the suggestions on this page, but nothing worked.

I tried this GeSHi extenstion and it worked right out of the box. http://www.mediawiki.org/wiki/Extension:GeSHiCodeTag

Just thought I would post this for others who can't get this to work for them.