Extension talk:SyntaxHighlight

Jump to: navigation, search

About this board

Edit description


Previous discussion was archived at Extension talk:SyntaxHighlight/Archive 2017 on 2017-03-29.

By clicking "Add topic", you agree to our Terms of Use and agree to irrevocably release your text under the CC BY-SA 3.0 License and GFDL
Mayazcherquoi (talkcontribs)

How can I force Pygmentize to render output using the "colorful" style, as per: http://pygments.org/docs/styles/ ?

I have tried setting the following:

$wgPygmentizePath = '/usr/bin/pygmentize -S colorful';

However, this will just cause Pygmentize to error out on any pages containing a SyntaxHighlight block.


Reply to "Control Pygmentize style?"

Passing code via GET param to external site

Bjohas (talkcontribs)


Is there any way that a <syntaxhighlight>ABC</syntaxhighlight> segement could produce a link to an external site passing the code via GET? I.e. could the <syntaxhighlight server="myserver?Q=">ABC</syntaxhighlight> also produce a link myserver?Q=urlencode:ABC ?

The OSM wiki is trying to do this here with templates: https://wiki.openstreetmap.org/wiki/Template:OverpassTurboExample, but the problem is that this only works if "ABC" is (wiki-)escaped, which is somewhat limiting. Ideally the unescaped ABC would be passed to <syntaxhighlight>, and syntaxhighlight could generate the link.


(Also see Help_talk:Magic_words#urlencode:syntaxhighlight.3E....2Fsyntaxhighlight.3E)

PerfektesChaos (talkcontribs)

I did not fully undestand your plan, but I answered on Help talk:Magic words.

TL;DR: {{#tag:}}

Bjohas (talkcontribs)

Many thanks!

Reply to "Passing code via GET param to external site" (talkcontribs)

It highlights c for no reason.

SELECT * FROM cable AS c


SELECT * FROM cable AS tt
Reply to "A bug in tSQL highlighting"

Unexpected output from Pygments encountered

Ganomix (talkcontribs)

For some reason, syntaxhighlight isn't working for me. If I type e.g.:

<syntaxhighlight lang="python">
print "hello world"

I then get the following error:

[9b512e3be13749e9a6105d0f] /wiki/index.php?title=Test222&action=submit MWException from line 168 of C:\inetpub\wwwroot\wiki\extensions\SyntaxHighlight_GeSHi\SyntaxHighlight_GeSHi.class.php: Unexpected output from Pygments encountered Backtrace:

0 C:\inetpub\wwwroot\wiki\includes\parser\Parser.php(4262): SyntaxHighlight_GeSHi::parserHook(string, array, Parser, PPFrame_DOM)
1 C:\inetpub\wwwroot\wiki\includes\parser\Preprocessor_DOM.php(1260): Parser->extensionSubstitution(array, PPFrame_DOM)
2 C:\inetpub\wwwroot\wiki\includes\parser\Parser.php(3366): PPFrame_DOM->expand(DOMElement, integer)
3 C:\inetpub\wwwroot\wiki\includes\parser\Parser.php(1248): Parser->replaceVariables(string)
4 C:\inetpub\wwwroot\wiki\includes\parser\Parser.php(446): Parser->internalParse(string)
5 C:\inetpub\wwwroot\wiki\includes\content\WikitextContent.php(331): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
6 C:\inetpub\wwwroot\wiki\includes\content\AbstractContent.php(497): WikitextContent->fillParserOutput(Title, NULL, ParserOptions, boolean, ParserOutput)
7 C:\inetpub\wwwroot\wiki\includes\EditPage.php(3707): AbstractContent->getParserOutput(Title, NULL, ParserOptions)
8 C:\inetpub\wwwroot\wiki\includes\EditPage.php(2492): EditPage->getPreviewText()
9 C:\inetpub\wwwroot\wiki\includes\EditPage.php(600): EditPage->showEditForm()
10 C:\inetpub\wwwroot\wiki\includes\actions\EditAction.php(59): EditPage->edit()
11 C:\inetpub\wwwroot\wiki\includes\actions\SubmitAction.php(38): EditAction->show()
12 C:\inetpub\wwwroot\wiki\includes\MediaWiki.php(503): SubmitAction->show()
13 C:\inetpub\wwwroot\wiki\includes\MediaWiki.php(288): MediaWiki->performAction(Article, Title)
14 C:\inetpub\wwwroot\wiki\includes\MediaWiki.php(745): MediaWiki->performRequest()
15 C:\inetpub\wwwroot\wiki\includes\MediaWiki.php(519): MediaWiki->main()
16 C:\inetpub\wwwroot\wiki\index.php(43): MediaWiki->run()
17 {main}

Any ideas on how to fix this issue?

I am running MediaWiki 1.27.1 and Syntaxhighlight 2.0 (36820f3).

Ganomix (talkcontribs)

I updated pygments from version 2.1.3 to 2.2.0 and set $wgPygmentizePath = "c:\\Python27\\Scripts\\pygmentize.exe"; in LocalSettings.php.

That seems to have fixed the problem.

Reply to "Unexpected output from Pygments encountered"
TheDJ (talkcontribs)
1 def quickSort(arr):
2 	less = []
3 	pivotList = []
4 	more = []
5 	if len(arr) <= 1:
6 		return arr
7 	else:
8 		pass
IKhitron (talkcontribs)

The css classes are not loaded.

Reply to "Test"
There are no older topics