摸了好久,終於成功了
分享一下給有需要的人,以節省各位再花時間去摸索
首先到 SyntaxHighlighter 網站,下載套件
解壓縮後有兩個檔案是我們等等要上傳至網頁空間的,
分別是:scripts / shCore.js、styles / shCore.css
接著到 http://ppt.cc/6tac 下載 shThemeDefault.css 和 shBrushObjC.js
接著,我們在到 google site 建立一個 "協作平台"
新增頁面
使用 “檔案櫃" 當做範本
上傳剛剛的四個檔案
此時我們可以得到 4 個去掉 ? 參數後面的檔案連結: (同時將 https 改成 http)
http://sites.google.com/site/ertt0001/objc/shBrushObjC.js
https://sites.google.com/site/ertt0001/objc/shCore.css
https://sites.google.com/site/ertt0001/objc/shCore.js
https://sites.google.com/site/ertt0001/objc/shThemeDefault_1.css
修改 Blogger 範本
在 標籤下, 新增以下的內容:
<!-- start for Syntax Highlighting -->
<link href='http://sites.google.com/site/ertt001/objc/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://sites.google.com/site/ertt001/objc/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://sites.google.com/site/ertt001/objc/shCore.js' type='text/javascript'/>
<script src='http://sites.google.com/site/ertt001/objc/shBrushObjC.js' type='text/javascript'/>
<script type='text/javascript']]>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>
<!-- end for Syntax Highlighting —>
然後就可以開始使用啦!
使用方式:在要貼程式碼的地方加上以下標籤
<pre class="brush: objc; toolbar: false;">
//post code here
</pre>
成果大概是這樣:
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"Hello World");
}
參考網址:
http://itouchs.blogspot.tw/2011/11/blogspot-objective-c-syntax.html
http://jaminya.com/index.php/en/component/content/article/40-css/50-objc-syntax-highlight





