Ads 468x60px

##EasyReadMore##

07 10月, 2010

[Blogger]如何在布落格裡插入程碼的項目

1.先至官方網站SyntaxHiglighter的官方下載網頁下載壓縮包

2.解壓縮後放至您的網路空間

3.在您的Blog加入以下程式碼

yoursite為你放置的網路空間路徑

<!-- Include required JS files -->
<script type="text/javascript" src="js/shCore.js"></script>
<!--
    At least one brush, here we choose JS. You need to include a brush for every
    language you want to highlight
-->
<script type="text/javascript" src="css/shBrushJScript.js"></script>
<!-- Include *at least* the core style and default theme -->
<link href="css/shCore.css" rel="stylesheet" type="text/css" />
<link href="css/shThemeDefault.css" rel="stylesheet" type="text/css" />

<!-- Finally, to actually run the highlighter, you need to include this JS on your page -->
<script type="text/javascript">
     SyntaxHighlighter.all()
</script>

4.再找到模版中所有有關「code」的css程式碼,並且去掉,並且儲存模版。

5.而要使用的話,只要用將程式碼用<pre class="brush: 程式語法;"></pre>包起來即可,如以下的範例。


<pre class="brush: js">
function foo()
{
}
</pre>

0 意見:

張貼留言

 
Blogger Templates