[dokuwiki] Re: Add colors inside a code section.
- From: Chris Smith <chris@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Tue, 15 Nov 2005 17:40:45 +0000
Samuel Degrande wrote:
Hello.
I would like to be able to 'manually' colorize some words inside a
'code' section.
Is there a solution ?
Are you applying a language to the code? e.g. <code php>
If so GeSHi will highlight many parts of the text. You can apply your
own styles to override the default Dokuwiki colours for the GeSHi styles.
Alternatively, you could modify either the code or file component of the
code plugin to accept the color syntax mode while within its own mode.
It should be enough to add the following code within the
plugin_code_code (or plugin_code_code) class block (but outside any
other code blocks) ...
(file: lib/plugins/code/syntax/code.php or lib/plugins/code/syntax/file.php)
function accepts($mode) {
if ($mode=='plugin_color') return true;
return false;
}
However you will need to be careful, as plugin_color itself accepts
other syntax modes which could lead to some odd results. I guess the
safe solution would be one of the following two alternatives:
- duplicate plugin_color with a slightly different name, alter class and
syntax modes to new name. modify getAllowedTypes in the copy to return
an empty array. modify code or file components to only allow the copy
color plugin.
- use "addPattern" in the code or file component plugins to merge color
handling from color plugin with code/file plugins.
Cheers,
Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts: