內容簡介
這個外掛是一個語法高亮插件,使用 GeSHi 作為字體引擎。
使用方法
將程式碼片段放在 “` 標籤內。
在程式碼標籤中加入語言屬性,像這樣:<code lang="php">
如果您希望從非第一行開始編號,可以在 <code> 標籤後添加 lineno 屬性。例如:<code lang="cpp" lineno="42">
如果您沒有加入語言屬性,則<code> 標籤會正常處理。
如果您需要邊框,可以在 .css 文件中添加以下樣式:code { border: 1px dotted #ccc; padding: 0.2em 0.5em; }
您可以在 lang 中使用以下語言:abap, actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, c_mac, caddcl, cadlisp, cfdg, cfm, cpp-qt, cpp, csharp, css-gen, css, d, delphi, diff, div, dos, dot, eiffel, fortran, freebasic, genero, gml, groovy, haskell, html4strict, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, m68k, matlab, mirc, mpasm, mysql, nsis, objc, ocaml-brief, ocaml, oobas, oracle8, pascal, per, perl, php-brief, php, plsql, python, qbasic, rails, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vb, vbnet, vhdl, visualfoxpro, winbatch, xml, xpp, z80
注意:版本 1.9 支持 <code> 標籤,但為了保持向後兼容,不會刪除對 <pre> 標籤的支持。
已知問題
因為這個外掛使用正則表達式從 <code lang="some"> 至 “` 的字串範圍進行匹配,所以您不能在程式碼片段中使用 </code>。如果必須放置 </code> 標籤,您可以在 </code> 之間添加一個空格,例如:< /code>。插件會自動將 < /code> 轉換為 </code>。
如果您想要更改樣式,您應該修改插件源文件。 😛
外掛標籤
開發者團隊
原文外掛簡介
This plugin is a syntax highlighter for source code. It uses GeSHi as fontifier engine.
Usage
Put the code snippet in a “` tag.
Add the lang attribute to the code tag like the following.
Add the lineno attribute to the tag after the lang tag if you wish to start at a line other than 1.
If you do not add lang attribute, the tag is handled normally.
If you want to have border, add the style like the following to your .css file. code { border: 1px dotted #ccc; padding: 0.2em 0.5em; }
You can use following languages in lang. abap, actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, c_mac, caddcl, cadlisp, cfdg, cfm, cpp-qt, cpp, csharp, css-gen, css, d, delphi, diff, div, dos, dot, eiffel, fortran, freebasic, genero, gml, groovy, haskell, html4strict, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, m68k, matlab, mirc, mpasm, mysql, nsis, objc, ocaml-brief, ocaml, oobas, oracle8, pascal, per, perl, php-brief, php, plsql, python, qbasic, rails, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vb, vbnet, vhdl, visualfoxpro, winbatch, xml, xpp, z80
Note: Version 1.9 adds support for tags, however to ensure backwards compatibility support for the
tag will not be removed.
Known issuesBecause this plugin uses regular expression to match string range from
to “`, you can’t usein your code snippet. If you must put the tag, you can put a space between < and /code> like < /code>. The < /code> is converted to automatically by plugin.
If you want to change the style, you should modify the plugin source file. 😛延伸相關外掛
