当前位置: 主页 > 日志 > WEB UI >

推荐一款代码高亮插件:SyntaxHighlighter

推荐一款代码高亮插件:SyntaxHighlighter ,也就是我博客现在所使用的代码高亮插件。

官方网站:http://code.google.com/p/syntaxhighlighter/

SyntaxHighlighter_1.5.0.zip

 

使用方法如下(顺便可以看下效果):

<html>
<head>
<!--css for code highlight begin,SyntaxHighlighter-->
<link type="text/css" rel="stylesheet" href="highlighter/css/SyntaxHighlighter.css"></link>
<!--css for code highlight begin-->

</head>

<body>

<pre name="code" class="c">
  int main()
  {
    return 0;
  }
</pre>

<!--js for code highlight begin,SyntaxHighlighter-->

<script class="javascript" src="highlighter/js/shCore.js"></script>
<script class="javascript" src="highlighter/js/shBrushCSharp.js"></script>
<script class="javascript" src="highlighter/js/shBrushPhp.js"></script>
<script class="javascript" src="highlighter/js/shBrushJScript.js"></script>
<script class="javascript" src="highlighter/js/shBrushJava.js"></script>
<script class="javascript" src="highlighter/js/shBrushVb.js"></script>
<script class="javascript" src="highlighter/js/shBrushSql.js"></script>
<script class="javascript" src="highlighter/js/shBrushXml.js"></script>
<script class="javascript" src="highlighter/js/shBrushDelphi.js"></script>
<script class="javascript" src="highlighter/js/shBrushPython.js"></script>
<script class="javascript" src="highlighter/js/shBrushRuby.js"></script>
<script class="javascript" src="highlighter/js/shBrushCss.js"></script>
<script class="javascript" src="highlighter/js/shBrushCpp.js"></script>
<script class="javascript">
	dp.SyntaxHighlighter.ClipboardSwf = 'highlighter/flash/clipboard.swf';
	dp.SyntaxHighlighter.HighlightAll('code');
</script>

<!--js for code highlight end-->

</body>
</html>

 

SyntaxHighlighter支持的语言别名表:

Language Aliases
C++ cppcc++
C# c#c-sharpcsharp
CSS css
Delphi delphipascal
Java java
Java Script jsjscriptjavascript
PHP php
Python pypython
Ruby rbrubyrailsror
Sql sql
VB vbvb.net
XML/HTML xmlhtmlxhtmlxslt

[日志信息]

该日志于 2010-12-04 20:27 由 redice 发表在 redice's Blog ,你除了可以发表评论外,还可以转载 “推荐一款代码高亮插件:SyntaxHighlighter” 日志到你的网站或博客,但是请保留源地址及作者信息,谢谢!!    (尊重他人劳动,你我共同努力)
   
验证(必填):   点击我更换验证码

redice's Blog  is powered by DedeCms |  Theme by Monkeii.Lee |  网站地图 |  本服务器由西安鲲之鹏网络信息技术有限公司友情提供

返回顶部