dp.SyntaxHighlighter v1.5.1 Demo





官方網站:http://code.google.com/p/syntaxhighlighter




針對需要程式碼著色的地方,使用<pre name="code" class="程式碼種類">


程式碼種類:



C

cpp,c,c++



C#

c#,c-sharp,csharp



CSS

css



Delphi

delphi,pascal



Java

java



JavaScript

js,jscript,javascript



PHP

php



Python

py,python



Ruby

ruby,rails,ror



SQL

sql



VBScript

vb,vb.net



XML

xml,xhtml,xslt,html,xhtml




範例:<pre name="code" class="javascript">var a=1;</pre>


代表使用javascript的語法著色





<pre name="code" class="php">code here</pre>


//php code<?phpvar $test_var=true;for(var $i=0;$i<10;$i++){	echo $i."\n";}?>


<pre name="code" class="css">code here</pre>


/*css code*/.some_class{	color:#3366FF;}


<pre name="code" class="html">code here</pre>


<!--html code--><b>this is html</b>


<pre name="code" class="javascript">code here</pre>


//javascript codefunction fn1(){  alert('this is javascript fn1');}


<pre name="code" class="vb">code here</pre>


'vb codeFunction Fn1  message "this is vb Fn1"End Function


<pre name="code" class="java">code here</pre>


//java codepublic static HuffmanEncoded Encode( Object obj)throws IOException{	// serialize object	if ((obj instanceof Serializable) || (obj instanceof Externalizable)){		// create an output byte array		ByteArrayOutputStream raw = new ByteArrayOutputStream();		// create an object Output stream		ObjectOutputStream out = new ObjectOutputStream(raw);		// write object to output stream		out.writeObject(obj);		out.flush();		// encode bytes		return Compress(raw.toByteArray());	}	else		throw new HuffmanException("can't encode non-serializable object");	}}


<pre name="code" class="sql">code here</pre>


SELECT  user.name FROM users WHERE user.boss='gan068' ORDER BY user.id DESC;
創作者介紹
創作者 gan068 的頭像
gan068

gan068

gan068 發表在 痞客邦 留言(0) 人氣( 35 )