19

The font size of my code snippets are too small relative to the default font size of the Wiki, which makes them hard to read (see below for an example). Is there anything I can do to change it?

Example:

enter image description here

The code that generates the above is:

==== Histograms ====
This is the code to compute the histogram:
<source lang="matlab">
nEls = numel(unique_vals);
edges = zeros(nEls+2,1);
</source>
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564

4 Answers4

23

Edit the MediaWiki:Geshi.css.

Example:

div.mw-geshi div,pre {
 font-family: monospace, "Courier New" !important;
 font-size:13px;
}
Adrian Archer
  • 2,323
  • 1
  • 17
  • 20
  • Thanks @Adrian Archer. My MediaWiki installation (latest version) does not seem to have this file (nor does my SyntaxHighlight Geshi installation, which also uses the latest version of the extension). Where is this file supposed to be? Where can I find more information about this particular css file? Is it part of the official extension installation? – Amelio Vazquez-Reina Mar 18 '11 at 18:45
  • 4
    It is not a file, it is a wiki page. – Tgr Mar 19 '11 at 23:32
  • i have the same problem and just don't get what they mean in the documentation with the "Geshi.css" file. – Staeff Mar 20 '11 at 09:37
  • 13
    ok now i get it you have to enter http:///index.php?title=MediaWiki:Geshi.css and edit this file – Staeff Mar 20 '11 at 09:44
4

edit your SyntaxHighlight_GeSHi.class.php

add font-size to following line

$css[] = ".source-$lang {line-height: normal; font-size: 12px;}";
3

Turns out this is a bug in the MediaWiki extension. It is referenced in the bug tracker at https://bugzilla.wikimedia.org/show_bug.cgi?id=26204

We can get a permanent fix in it, will poke some other peoples to get it properly fixed.

  • And it was fixed in MediaWiki 1.24. :) [Everyone upgrade](https://www.mediawiki.org/wiki/Manual:Upgrading)! – Nemo May 03 '15 at 06:15
0

MediaWiki v1.19.23/24 with geshi 1.0.8.11/12:

Edit the Mediawiki:Geshi.css file to be:

/* CSS placed here will be applied to GeSHi syntax highlighting */
div.mw-geshi div,pre {
 font-family: monospace, "Courier New" !important;
 font-size:13px;
 border: 1px dashed blue;
}

span.mw-geshi {
 font-family: monospace, "Courier New" !important;
 font-size:13px;

This will work for both the inline (<source lang="XXX" console="none">CODE</source>) and for the normal divs (<source lang="XXX">CODE</source>). The source is now preferred to be replaced with syntaxhighlight.

Biz Web
  • 11
  • 3