A syntax highlighting extension based on GeSHi is now live on test.wikipedia.org. There's a test page at:
http://test.wikipedia.org/wiki/SyntaxHighlight_GeSHi
The documentation is now out-of-date, but it might contain some useful information:
http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
Some comments and background about the review process are at:
http://bugzilla.wikimedia.org/show_bug.cgi?id=7163
I'd like to invite comments now. I'll be aiming to deploy it on the main site some time in the next week.
-- Tim Starling
2007/4/6, Tim Starling tstarling@wikimedia.org:
A syntax highlighting extension based on GeSHi is now live on test.wikipedia.org. There's a test page at:
http://test.wikipedia.org/wiki/SyntaxHighlight_GeSHi
The documentation is now out-of-date, but it might contain some useful information:
http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
Not enough intensive colors in first few lines :(
People wearing glasses would have problems with reading it!
AJF/WarX
You may want to disable the inline <style> declarations and move all the CSS to an externally loaded document like Common.css.
(Yes, yes, I know that premature optimization is the root of all evil)
-- Jim R. Wilson (jimbojw)
On 4/6/07, Artur Fijałkowski wiki.warx@gmail.com wrote:
2007/4/6, Tim Starling tstarling@wikimedia.org:
A syntax highlighting extension based on GeSHi is now live on test.wikipedia.org. There's a test page at:
http://test.wikipedia.org/wiki/SyntaxHighlight_GeSHi
The documentation is now out-of-date, but it might contain some useful information:
http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
Not enough intensive colors in first few lines :(
People wearing glasses would have problems with reading it!
AJF/WarX
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Wilson wrote:
You may want to disable the inline <style> declarations and move all the CSS to an externally loaded document like Common.css.
(Yes, yes, I know that premature optimization is the root of all evil)
No, it's a good point. If they don't get moved, admins can't customize the colors of the syntax highlighting.
Jim Wilson wrote:
You may want to disable the inline <style> declarations and move all the CSS to an externally loaded document like Common.css.
(Yes, yes, I know that premature optimization is the root of all evil)
The colours are hard-coded into the language-specific files in GeSHi, so you can't generate a compact stylesheet that works for all languages. We could have a separate generated stylesheet for each language, but that would mean an article like [[b:List of hello world programs]] might need to load 50 stylesheets, which would be slow.
Admins should be able to customise the colours by using selectors that are more specific than the default GeSHi selectors.
-- Tim Starling
You could give the wrapper elements (<pre> and <div> tags) CSS classes to identify that it's source code and what language.
So
<source lang="php"> echo('hi there'); </source>
Might become
<pre class="sourcecode php"> .... </pre>
Then the pre-generated GeShi files could be modified to have all elements prefixed with .sourcecode .php or whatever.
It would probably make sense though to put all of this generated stuff into something other than Common.css but still loaded via a <link> tag which only appears on pages with at least one <source> block. Reason being that the CSS for all supported GeShi languages will probably be large, and unnecessary for the wide gamut of Wikipedia articles.
-- Jim
On 4/6/07, Tim Starling tstarling@wikimedia.org wrote:
Jim Wilson wrote:
You may want to disable the inline <style> declarations and move all the
CSS
to an externally loaded document like Common.css.
(Yes, yes, I know that premature optimization is the root of all evil)
The colours are hard-coded into the language-specific files in GeSHi, so you can't generate a compact stylesheet that works for all languages. We could have a separate generated stylesheet for each language, but that would mean an article like [[b:List of hello world programs]] might need to load 50 stylesheets, which would be slow.
Admins should be able to customise the colours by using selectors that are more specific than the default GeSHi selectors.
-- Tim Starling
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
Jim Wilson wrote:
You could give the wrapper elements (<pre> and <div> tags) CSS classes to identify that it's source code and what language.
So
<source lang="php"> echo('hi there'); </source>
Might become
<pre class="sourcecode php"> .... </pre>
Then the pre-generated GeShi files could be modified to have all elements prefixed with .sourcecode .php or whatever.
That's what it does already, except for the bit about generating files.
It would probably make sense though to put all of this generated stuff into something other than Common.css but still loaded via a <link> tag which only appears on pages with at least one <source> block. Reason being that the CSS for all supported GeShi languages will probably be large, and unnecessary for the wide gamut of Wikipedia articles.
Yes it would be large, which is why I didn't make it that way.
-- Tim Starling
Yes it would be large, which is why I didn't make it that way.
Here's my proposal (in as much detail as I can muster):
1) Give all <pre> and <div> tags generated from <source> a css class (or several).
2) Modify Brion's syntax-hightlight extension so that it doesn't add any <style> tags to the header, but a single <link> instead OR one <link> for each language represented in the article. Preferably this would be earlier in the link chain than User CSS so that users can modify how source code looks for themselves.
3) Set the link urls to the "action=raw&ctype=text/css&maxage=whatever" version of something like "MediaWiki:SyntaxHighlighting.css" or "MediaWiki: SyntaxHighlighting-LANG.css" where LANG is the name of a language used in a <source> element in the page.
4) Fill MediaWiki:SyntaxHighlighting.css or MediaWiki: SyntaxHighlighting-LANG.css files with the GeShi generated versions of all the css, modified slightly so that all selectors are prefixed with the class/classes identified in step 1.
I feel that the gains of doing this are the following:
1) Less bandwidth since the style information is not being fed for every page which happens to contain a <source> block (the syntax highlighting files can be browser/proxy cached)
2) If the <link> is added early enough in the document <head>, then either Skin CSS or User CSS could be used to override the styles.
I don't pretend to know everything there is to know about this problem or how wikipedia does business, so if there are flaws/holes in the proposal above, I'd love to hear them so that together we can come up with the best solution. :)
-- Jim
On 4/6/07, Tim Starling tstarling@wikimedia.org wrote:
Jim Wilson wrote:
You could give the wrapper elements (<pre> and <div> tags) CSS classes
to
identify that it's source code and what language.
So
<source lang="php"> echo('hi there'); </source>
Might become
<pre class="sourcecode php"> .... </pre>
Then the pre-generated GeShi files could be modified to have all
elements
prefixed with .sourcecode .php or whatever.
That's what it does already, except for the bit about generating files.
It would probably make sense though to put all of this generated stuff
into
something other than Common.css but still loaded via a <link> tag which
only
appears on pages with at least one <source> block. Reason being that
the
CSS for all supported GeShi languages will probably be large, and unnecessary for the wide gamut of Wikipedia articles.
Yes it would be large, which is why I didn't make it that way.
-- Tim Starling
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Fri, 06 Apr 2007 06:55:10 +0100, Tim Starling wrote:
A syntax highlighting extension based on GeSHi is now live on test.wikipedia.org. There's a test page at:
It's looks nice, but it would be nice if the code was easier to read.
The colors seem too light for good contrast with a white background, but some don't show up with a dark background, either. It would be nice to have a default dark on light scheme for the normal background, and maybe a light on dark if you want to reverse it.
It doesn't seem to allow passing a style option to affect the div, but that's fairly minor, since you can always add another div.
It would be nice if the lines were less obtrusive, and more obviously not a part of the code; I.e. smaller, lighter, and only visible every fifth line.
On Fri, 06 Apr 2007 06:55:10 +0100, Tim Starling wrote:
A syntax highlighting extension based on GeSHi is now live on test.wikipedia.org. There's a test page at:
One other small thing, it would be nice if it could display wrapped lines somehow; maybe an arrow character at the end or such. The border drawn right through the code doesn't look good.
Did this get deployed? Is it deployed on mediawiki.org? It would be very nice to have there. For example, for putting the code of small extensions on wiki pages.
Jim On Apr 6, 2007, at 1:55 AM, Tim Starling wrote:
A syntax highlighting extension based on GeSHi is now live on test.wikipedia.org. There's a test page at:
http://test.wikipedia.org/wiki/SyntaxHighlight_GeSHi
The documentation is now out-of-date, but it might contain some useful information:
http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
Some comments and background about the review process are at:
http://bugzilla.wikimedia.org/show_bug.cgi?id=7163
I'd like to invite comments now. I'll be aiming to deploy it on the main site some time in the next week.
-- Tim Starling
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
Tim Starling-2 wrote:
A syntax highlighting extension based on GeSHi is now live on test.wikipedia.org. There's a test page at: http://test.wikipedia.org/wiki/SyntaxHighlight_GeSHi I'd like to invite comments now. I'll be aiming to deploy it on the main site some time in the next week.
There seems to be a bug in the Python example, where the leading space on the first line is missing.
HTH HAND
wikitech-l@lists.wikimedia.org