添加syntax highlight代码高亮模块到博客Blogger.com

  一直感觉博客上要写好多代码,今天终于找到了一个好的代码高亮模块:syntax highlight,把这个代码高亮设置添加到博客里面很简单,在您的Blogger布局里面<!-- end outer-wrapper -->标签后添加如下代码即可,不用的可删除,但是shCore.js不能删除:
<link href='http://flash-host.com.br/blog/sh/SyntaxHighlighter.css' rel='stylesheet' type='text/css'/>

<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shCore.js'></script>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushCSharp.js'></script>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushXml.js'></script>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushPython.js'></script>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushJScript.js'></script>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushDelphi.js'></script>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushPhp.js'></script>
<script language='javascript' src='http://syntaxhighlighter.googlecode.com/svn-history/r57/trunk/Scripts/shBrushJava.js'></script>

<script language='javascript'>
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
</script>
当添加代码的时候,书写格式如下:
<pre class="java" name="code">代码</pre>

本文地址:http://oceanban.blogspot.com/2010/04/syntax-highlight-bloggercom.html
原创文章如转载,请注明链接: 转自OceanBan的空间

2 评论:

Lue 说... 回复此评论

请问您是怎么做到的这个效果呢? 我按照您的做法 复制后
看文章出现了行号, 还有 语法检查,
我的那些数字都变成红色了,我想要您这样的简洁的效果 该去掉哪些东西呢?

冒昧的问一句,能否把您的现在最新的模版导出一份给我?觉得您的模版被您优化的很好了,所以冒昧的希望您能够给我一份.

Ocean Ban : 回复此评论

@LueEon
已经发送