其实Syntax Highlighter and Code Prettifier Plugin是一个很好用的语法高亮工具,看看其主页上面说的多NB:
“SyntaxHighlighter is currently used by Apache, Aptana, Mozilla, Yahoo, WordPress, Bug Labs, Freshbooks and others.”
那么多大用户,可以肯定它是很好用的,但是在wordpress怎么用,我是没怎么找到说明文档,都是靠自己摸索的,使用方法如下:
在需要加语法高亮的代码前加入<pre class=”brush: js”> ,后面用</pre>结尾。brush后面就是语法的语言,这个我找来找去终于找到它全部支持的语法及在这个pre里面的表示方法(还要翻墙,晕死):
SyntaxHighlighter uses separate syntax files called brushes to define its highlighting functionality.
Brush name | Brush aliases | File name |
---|---|---|
ActionScript3 | as3, actionscript3 | shBrushAS3.js |
Bash/shell | bash, shell | shBrushBash.js |
ColdFusion | cf, coldfusion | shBrushColdFusion.js |
C# | c-sharp, csharp | shBrushCSharp.js |
C++ | cpp, c | shBrushCpp.js |
CSS | css | shBrushCss.js |
Delphi | delphi, pas, pascal | shBrushDelphi.js |
Diff | diff, patch | shBrushDiff.js |
Erlang | erl, erlang | shBrushErlang.js |
Groovy | groovy | shBrushGroovy.js |
JavaScript | js, jscript, javascript | shBrushJScript.js |
Java | java | shBrushJava.js |
JavaFX | jfx, javafx | shBrushJavaFX.js |
Perl | perl, pl | shBrushPerl.js |
PHP | php | shBrushPhp.js |
Plain Text | plain, text | shBrushPlain.js |
PowerShell | ps, powershell | shBrushPowerShell.js |
Python | py, python | shBrushPython.js |
Ruby | rails, ror, ruby | shBrushRuby.js |
Scala | scala | shBrushScala.js |
SQL | sql | shBrushSql.js |
Visual Basic | vb, vbnet | shBrushVb.js |
XML | xml, xhtml, xslt, html, xhtml | shBrushXml.js |
第一列就是所支持的语言,第二列是该语言在这个插件里面的写法,第三列在wordpress里面可以不管了。
希望能帮到一些英文菜鸟吧。
正文完