2011年2月24日星期四

代码高亮示例


int main()
{
int a=2;
return 0;
}


简码参数

这些参数你能够设置在简码中。对于布尔值(即 on/off),使用 true/1 或者 false/0。

* lang or language — The language syntax to highlight with. You can alternately just use that as the tag, such as

code

. Click here for a list of valid tags (under "aliases").
* autolinks — Toggle automatic URL linking.
* classname — Add an additional CSS class to the code box.
* collapse — Toggle collapsing the code box by default, requiring a click to expand it. Good for large code posts.
* firstline — An interger specifying what number the first line should be (for the line numbering).
* gutter — Toggle the left-side line numbering.
* highlight — A comma-sperated list of line numbers to highlight. You can also specify a range. Example: 2,5-10,12
* htmlscript — Toggle highlighting any extra HTML/XML. Good for when you're mixing HTML/XML with another language, such as having PHP inside an HTML web page. The above preview has it enabled for example. This only works with certain languages.
* light — Toggle light mode which disables the gutter and toolbar all at once.
* padlinenumbers — Controls line number padding. Valid values are false (no padding), true (automatic padding), or an integer (forced padding).
* title (v3 only) — Sets some text to show up before the code. Very useful when combined with the collapse parameter.
* toolbar — Toggle the toolbar (buttons in v2, the about question mark in v3)
* wraplines (v2 only) — Toggle line wrapping.

一些简码示例

*

这里写你的代码

*

这里写你的代码


*

这里写你的代码


*

[sourcecode language="plain"]这里写你的代码[/sourcecode]

Languages Supported

* ActionScript3 (as3)
* Bash/shell (bash, shell)
* C, C++ (cpp, c, c++)
* C# (csharp)
* ColdFusion (coldfusion)
* CSS (css)
* Delphi (delphi, pascal)
* diff, patch (diff, patch)
* Erlang (erlang)
* Groovy (groovy)
* Java (java)
* Java Script (javascript)
* JavaFX (javafx)
* Perl (perl)
* PHP (php)
* Plain Text (plain, text)
* PowerShell (powershell)
* Python (python)
* Ruby (ruby)
* Scala (Scala)
* SQL (sql)
* Visual Basic (vb, vbnet)
* XML/HTML (xml, html, xhtml, xslt)

没有评论:

发表评论