SyntaxHighlighter for Habari

偶尔会在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

« 用iChat / Goolge Talk上MSN Fckeditor Plugin for Habari »

3 Responses to SyntaxHighlighter for Habari

gravatar 借助vim高亮代码 - 卍解 at June 24, 2008 2:45pm

gravatar Xmion at September 1, 2008 4:16pm

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.

gravatar wayne at September 2, 2008 9:26am

@Xmion: I will fix it after I migrate back to habari these days :D

Name (*)

Email Address (*)

Web Address

Other  Receive Email Notify

Comment