WP-Syntax使用起来还是有讲究滴,要想显示出特定的效果,还是要记一些标签滴。

 代码写在这儿</pre>

lang="java"         表示介代码是Java代码

line="X"            表示行号,不写这个的话就不会显示行号

escaped="true"   如果你的代码中包含HTML代码,这样设置可以避免HTML代码被转意掉

Hello</pre>

当然

code</pre>

这样写也是没问题题的啦。

lang属性支持以下语言:

(快速查找:CTRL+F)abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autoit, avisynth, bash, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cil, cfdg, cfm,cmake, cobol, cpp-qt, cpp, csharp, css, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, genero, gettext, glsl, gml, bnuplot, groovy, haskell, hq9plus,html4strict, idl, ini, inno, intercal, io, java, java5, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab,mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml, oobas, oracle11, oracle8, pascal, per, pic16, pixelbender, perl, php-brief, php, plsql, povray,powershell, progress, prolog, properties, providex, python, qbasic, rails, rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text,thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, z80

当然,我们最常用的也不过asp,bash,c,cpp,csharp,css,html4strict,java,java5,javascript,mysql,objc,oracle11,perl,php,python,rails,ruby,sql,vb,venet,xml 而已。

其中,范儿最常用的当然是c,cpp,csharp,css,html4strict,java,javascript,mysql,php,sql以及xml

插件中wp_syntax_init_geshi 给我们预留了hook,用这个钩子可以搞的更high,有关更多 wp_syntax_init_geshi 文档信息参见 GeSHi

参考:WordPress官方 GeSHi Examples