phpdokuwikigeshi

How to highlight codechanges in geshi


I have a running dokuwiki and am working with code-blocks like:

<code php>
<?php

 function addOne($testparam) {
  global $test;
  $test = $test + $testparam;
 }

?>
</code>

I now would like to highlight single lines of codes (like for example lines where something has changed).

My idea was to introduce a new Syntax-Keyword in the PHP language file php.php:

...
$language_data = array(
    'LANG_NAME' => 'PHP',
    'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
    'COMMENT_MULTI' => array('/*' => '*/'),
    'COMMENT_GESHI' => array('**' => '**'),   // new source
...
        'STYLES' => array(
            'KEYWORDS' => array(
                1 => 'color: #b1b100;',
                2 => 'color: #000000; font-weight: bold;',
                3 => 'color: #990000;',
                4 => 'color: #009900; font-weight: bold;'
                ),
            'COMMENTS' => array(
                1 => 'color: #666666; font-style: italic;',
                2 => 'color: #666666; font-style: italic;',
                3 => 'color: #0000cc; font-style: italic;',
                4 => 'color: #009933; font-style: italic;',
                'MULTI' => 'color: #666666; font-style: italic;',
                'GESHI' => 'color: #00ffff; font-weight: bold;'
                ),
...

Anyway that does not seem to have any effect.

Any idea?


Solution

  • DokuWiki does not use inline styles when rendering GeSHi. Instead common class names for all code languages are used and styled with a single, simple set of rules in lib/styles/screen.css.

    You can add or overwrite the GeSHi styling in your conf/userstyle.css (create the file and make sure to refresh DokuWiki's cache).