SyntaxHighlighter 作为一款比较优秀且常见的代码高亮插件,这里给出一个用法说明作为 Memo。
[csharp]
namespace Test
{
#region using directives
using System;
#endregion using directives
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}
[/csharp]
Plugin Usage
Just wrap your code in [language], such as
[[php]code here[/php]]
or
[[css]code here[/css]]
For a list of supported languages you could refer to the following table. And you do not need to escape HTML entities or anything, just post your code as-is. The plugin will handle the rest.
Brush name | Brush aliases |
---|---|
ActionScript3 | as3, actionscript3 |
Bash/shell | bash, shell |
ColdFusion | cf, coldfusion |
C# | c-sharp, csharp |
C++ | cpp, c |
CSS | css |
Delphi | delphi, pas, pascal |
Diff | diff, patch |
Erlang | erl, erlang |
Groovy | groovy |
JavaScript | js, jscript, javascript |
Java | java |
JavaFX | jfx, javafx |
Perl | perl, pl |
PHP | php |
Plain Text | plain, text |
PowerShell | ps, powershell |
Python | py, python |
Ruby | rails, ror, ruby |
Scala | scala |
SQL | sql |
Visual Basic | vb, vbnet |
XML | xml, xhtml, xslt, html, xhtml |
你可以从这里得到更多关于这个插件的信息: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/