如何在 geshi 中突出显示代码更改
我有一个正在运行的 dokuwiki,并且正在使用如下代码块:
<code php>
<?php
function addOne($testparam) {
global $test;
$test = $test + $testparam;
}
?>
</code>
我现在想突出显示单行代码(例如,某些内容已更改的行)。
我的想法是在 PHP 语言文件 php.php 中引入一个新的 Syntax-Keyword:
...
$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;'
),
...
无论如何,这似乎没有任何效果。
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DokuWiki 在渲染 GeSHi 时不使用内联样式。相反,使用所有代码语言的通用类名,并通过
lib/styles/screen.css
中的一组简单规则进行样式设置。您可以在
conf/userstyle.css
中添加或覆盖 GeSHi 样式(创建文件并确保刷新 DokuWiki 的缓存)。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).