2014年4月22日 星期二

SyntaxHighlighter 簡單教學

1: google blog->範本->編輯html

在</head>上面加入下面

<script src='https://sites.google.com/site/你的網址/home/shCore.js' type='text/javascript'/>
<script src='https://sites.google.com/site/你的網址/home/shBrushCpp.js' type='text/javascript'/>
<link href='https://sites.google.com/site/你的網址/home/shCore.css' rel='stylesheet' type='text/css'/>
<link href='https://sites.google.com/site/你的網址/home/shThemeDefault.css' rel='stylesheet' type='text/css'/>

<script type='text/javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script>

shBrushCpp.js請置換成你所使用的語言
http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/

2: 請使用HTML編輯你的source code
<pre class="brush:c">
你的source code.
 </pre>

如果你的程式碼貼上後,有警告訊息,請將程式碼做轉換
http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx

3:預覽有時看不出效果的,也許你讀js太慢.或是google 預覽問題?

4:如果你讀css太久,會造成顯示錯誤. 我原先是用
http://agorbatchev.typepad.com/pub/sh/3_0_83/styles/shCore.css  <--這有時有用.XD...

沒有留言:

張貼留言