偶尔会在post里面贴点代码出来,尽管habari已经有了现成的GeShi插件,不过个人来讲更喜欢用dp.SyntaxHighlighter来实现,所以便有了这个东东
支持的语言:
- C++ -- cpp, c, c++
- C# -- c#, c-sharp, csharp
- CSS -- css
- Delphi -- delphi, pascal
- Java -- java
- JavaScript -- js, jscript, javascript
- PHP -- php
- Python -- py, python
- Ruby -- rb, ruby, rails, ror
- SQL -- sql
- VB -- vb, vb.net
- XML/HTML -- xml, html, xhtml, xslt
使用方法:
[ sourcecode lang='language' ]code[ /sourcecode ]
说明:
1. lang属性是必须的,值可以上上述语言的任意一个
2. 使用时记得删除 [ ] 还有 sourcecode 之间的空格。
下载 SyntaxHighlighter for Habari
--------------------- 华丽的分割线 ---------------------
SyntaxHighlighter for Habari is used to highlight source code in your post.
It supports the languages below:
- C++ -- cpp, c, c++
- C# -- c#, c-sharp, csharp
- CSS -- css
- Delphi -- delphi, pascal
- Java -- java
- JavaScript -- js, jscript, javascript
- PHP -- php
- Python -- py, python
- Ruby -- rb, ruby, rails, ror
- SQL -- sql
- VB -- vb, vb.net
- XML/HTML -- xml, html, xhtml, xslt
Usage:
Insert some bbcode like this:
[ sourcecode lang='language' ]code[ /sourcecode ]
And please pay attention to:
1. lang attribute is required, the value is listed above, py, python, etc.
2. REMEMBER that there is NO space in [,] and 'sourcecode'
Download SyntaxHighlighter for Habari
Demo:
[ sourcecode lang='c']
#include ;
int main () {
printf ("Hello World!n");
}
[/sourcecode]
最终的显示结果是

DOWNLOAD SyntaxHighlighter for Habari
Hey wonder if there is any update for this plugin to Habari 0.5.x. I really like plugin but it was broken for me in 0.5
((. Thanks for a really great plugin.
@Xmion: I will fix it after I migrate back to habari these days