<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Another My Program &#187; syntax highlighter</title>
	<atom:link href="http://tim.diary.tw/tag/syntax-highlighter/feed/" rel="self" type="application/rss+xml" />
	<link>http://tim.diary.tw</link>
	<description>just another my program</description>
	<lastBuildDate>Sun, 29 Jan 2012 10:40:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://tim.diary.tw/?pushpress=hub'/>
		<item>
		<title>真是不錯的SyntaxHighlighter-Plus</title>
		<link>http://tim.diary.tw/2008/03/05/syntaxhighlighter-plus/</link>
		<comments>http://tim.diary.tw/2008/03/05/syntaxhighlighter-plus/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 18:08:00 +0000</pubDate>
		<dc:creator>tim</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[syntax highlighter]]></category>

		<guid isPermaLink="false">http://tim.diary.tw/2008/03/05/syntaxhighlighter-plus/</guid>
		<description><![CDATA[之前一直在找可以在 wordpress mu 版本下可用的 syntax highlighter, 試了許多都沒辦法很順利的使用, 到昨天找到了一個算可以用的版本, SyntaxHighlighter-Plus (連結). 怎麼說算可以用呢? 主要是因為他的目錄命名會和 wordpress mu內的urlrewrite 會有一些衝突, 因為他的目錄也有用到 "files" 這個關鍵字, 解決方式很簡單, 就是將 syntaxhighlighter-plus目錄內的 files 目錄改名, 並配合調整一下即可, 我將原來的 source 改了一下, 放到這裡來方便 wordpress mu 的用戶來安裝! SyntaxHighlighter-Plus for wordpress mu 使用方式原作者的說明很詳細了, 就是解壓安裝至 plugins 目錄後, 到後台啟用, 再於撰寫文章時, 切換至 "code"模式下(主要是避免 &#60; &#62; 角括號(小於, 大於符號會被 wordpress 編輯器改寫為 &#60; 及 &#62;), 使用[sourcecode language='xxx']程式碼[/sourcecode]的方式將程式碼包住就可以達到語法高亮的效果, 範例如下: [...]]]></description>
			<content:encoded><![CDATA[<p>之前一直在找可以在 wordpress mu 版本下可用的 syntax highlighter, 試了許多都沒辦法很順利的使用, 到昨天找到了一個算可以用的版本, SyntaxHighlighter-Plus (<a href="http://wordpress.org/extend/plugins/syntaxhighlighter-plus/">連結</a>). 怎麼說算可以用呢? 主要是因為他的目錄命名會和 wordpress mu內的urlrewrite 會有一些衝突, 因為他的目錄也有用到 "files" 這個關鍵字, 解決方式很簡單, 就是將 syntaxhighlighter-plus目錄內的 files 目錄改名, 並配合調整一下即可, 我將原來的 source 改了一下, 放到這裡來方便 wordpress mu 的用戶來安裝! <a href="http://tim.diary.tw/files/2008/03/syntaxhighlighter-plus.zip" title="SyntaxHighlighter-Plus for wordpress mu">SyntaxHighlighter-Plus for wordpress mu</a></p>
<p>使用方式原作者的說明很詳細了, 就是解壓安裝至 plugins 目錄後, 到後台啟用, 再於撰寫文章時, 切換至 "code"模式下(主要是避免 &lt; &gt; 角括號(小於, 大於符號會被 wordpress 編輯器改寫為 &lt; 及 &gt;), 使用[sourcecode language='xxx']程式碼[/sourcecode]的方式將程式碼包住就可以達到語法高亮的效果, 範例如下:</p>
<pre class="brush: php">// default display_errors value is on
ini_set(&#039;display_errors&#039;, Off);
$display_errors = ini_get(&#039;display_errors&#039;);
echo &quot;display_errors=$display_errors&lt;br /&gt;&quot;;
echo &quot;1/0&lt;br /&gt;&quot;;
$a = 1/0;  // nothing happened.
ini_restore(&#039;display_errors&#039;);
echo &quot;1/0&lt;br /&gt;&quot;;
$a = 1/0;
</pre>
<p>要特別注意的是即使第一次使用了 "code" 編輯模式存檔, 再編輯時, wordpress 編輯器仍會再做 &gt; &lt; 的轉碼, 這個是很討厭的一個麻煩問題.</p>
<p>這套程式一樣基於 dp.SyntaxHighlighter 的程式碼開發, 看了一下 for wordpress 的這個版本, plugin 的作者很貼心的設計了多組參數來簡化輸入, 如下:<br />
* `〔source language=&#8217;css&#8217;〕code here〔/source〕`<br />
* `〔code language=&#8217;css&#8217;〕code here〔/code〕`<br />
* `〔sourcecode lang=&#8217;css&#8217;〕code here〔/sourcecode〕`<br />
* `〔source lang=&#8217;css&#8217;〕code here〔/source〕`<br />
* `〔code lang=&#8217;css&#8217;〕code here〔/code〕`<br />
* `〔sourcecode=&#8217;css&#8217;〕code here〔/sourcecode〕`<br />
* `〔source=&#8217;css&#8217;〕code here〔/source〕`<br />
* `〔code=&#8217;css&#8217;〕code here〔/code〕`<br />
* `〔lang=&#8217;css&#8217;〕code here〔/lang〕`<br />
* `〔css〕code here〔/css〕` (or any of the supported language)<br />
(為避免衝碼, 已經上面的半型方括號改為全形的)</p>
<p>另外還有他會針對該文章內使用的 sourcecode  language的不同來進行   dp.SyntanHighlighter 的 js 載入, 例如只有 php 程式碼, 他就只載入  shBrushPhp.js , 當然 shCore.js 是一定都會載入的啦, 這樣的好處就可以節省了一些引入的 javascript 的 js 檔, 也相對比較快. 給各位參考!</p>
]]></content:encoded>
			<wfw:commentRss>http://tim.diary.tw/2008/03/05/syntaxhighlighter-plus/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

