SyntaxHighlighter

官方網站:http://alexgorbatchev.com/SyntaxHighlighter/

使用版本:3.0.83

官方空間:http://alexgorbatchev.com/SyntaxHighlighter/hosting.html

 

假如你的程式裡面有用到 < and > 這兩個符號,則要配合以下其中一個方法解決

1. 使用Format My Source Code for Blogging 來轉換符號: http://formatmysourcecode.blogspot.com/

使用的時候需要注意幾個地方

Embed Stylesheet: 此選項需要取消勾選

轉換後的資料需去除 <code>.....</code> 標籤

以及將<pre class="source-code"> 改成 <pre class=brush: html">

2. 使用 PreCode 來轉換(需下載安裝):http://precode.codeplex.com/

 PreCode詳細使用方式我就不另作說明了,來看以下程式碼吧!!

<!-- 核心程式 -->
    <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>
    <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js' type='text/javascript'></script>
    <!-- 相容1.5 <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shLegacy.js' type='text/javascript'></script> -->
    <!-- 控制卷軸顯示 --><link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
    <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<!-- 核心程式 -->
<!-- Mac OS AppleScript -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushAppleScript.js"></script>
<!-- ActionScript -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushAS3.js"></script>
<!-- LinuxBash -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js"></script>
<!-- Adobe ColdFusion -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js"></script>
<!-- CC++ -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js"></script>
<!-- C# -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js"></script>
<!-- Css -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js"></script>
<!-- Delphi -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDelphi.js"></script>
<!-- Diff -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDiff.js"></script>
<!-- Erlang -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushErlang.js"></script>
<!-- Groovy -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushGroovy.js"></script>
<!-- Java -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js"></script>
<!-- JavaFX -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJavaFX.js"></script>
<!-- JavaScript -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script>
<!-- Perl -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js"></script>
<!-- Php -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js"></script>
<!-- Plain -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPlain.js"></script>
<!-- MSPowerShell -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPowerShell.js"></script>
<!-- Python -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js"></script>
<!-- Ruby -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js"></script>
<!-- Sass -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSass.js"></script>
<!-- Scala -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushScala.js"></script>
<!-- 標準SQL語言 -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js"></script>
<!-- VB6 -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js"></script>
<!-- XML文件 -->
<script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js"></script>
<!-- 啟動碼 -->
    <script type='text/javascript'> 
        SyntaxHighlighter.all();
    </script>
<!-- 啟動碼 -->
<!-- 調用方法 <pre class="brush: php"></pre> -->

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