close

如你須經常在 Blog 分享程式碼,但又常因為貼上程式碼後排版問題...等,這時候就需要用到 syntaxhighlighter,將 syntaxhighlighter 下載後,插入到自己的 Blog。

詳細步驟如下:

Step one:至官網下載 http://alexgorbatchev.com/SyntaxHighlighter/

Step two:將下載的檔案上傳到你自己的空間。

Step three:將以下所有路徑及css 改為 src="YourWebSite/shBrushCss.js">











如果沒有空間可以儲存下載的 syntaxhighlighter,可改用下列程式碼貼在自己的 Blog。











<pre class="brush:js;">...</pre>之間插入程式碼

//接著就在 Blog HTML 插入 


class="brush:csharp;"

參考如下表:

Brush nameBrush aliasesFile name
Bash/shell bash, shell shBrushBash.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
Groovy groovy shBrushGroovy.js
JavaScript js, jscript, javascript shBrushJScript.js
Java java shBrushJava.js
Perl perl, pl shBrushPerl.js
PHP php shBrushPhp.js
Plain Text plain, text shBrushPlain.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
arrow
arrow

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