SyntaxHighlighter google开源项目(语法高亮、代码着色) - 开源空间 - 共享社区共享空间 - Powered by Discuz!NT

导读:


引言

syntaxhighlighter的目的是不依赖任何服务器端脚本即可在网页上插入着色后的代码

目标客户

主要是针对博客。不过,我看到了一些源码网站使用它作为其主要展示源代码的工具。

不适合客户

syntaxhighlighter不是针对那种强调在线编辑高亮代码的客户设计的,它不会让您编辑源代码,它不能这样做也绝不会这样做。

性能

syntaxhighlighter使用正则表达式解析源码。它不是非常快,事实上,它的速度相当缓慢。如果您想尝试百十行代码,您将不会看到任何问题。如果要高亮超过10k的源码,由于JavaScript运行时间过长会导致程序中止

SyntaxHighlighter is here to help a developer/coder to post code snippets online with ease and have it look pretty. It's 100% Java Script based and it doesn't care what you have on your server.

Features  Summary of features.

SyntaxHighlighter features


  • 100% client side, no server dependency
  • Multiple languages support
  • Easy to use and deploy, just copy files and link them in your templates
  • Wide browser support
  • Very lightweight, compressed core library is 11kb plus whatever brushes you need.


Languages  List of supported languages.

Supported languagesHere's a list of supported languages and their aliases:









































Language Aliases
C++ cpp, c, c++
C# c#, c-sharp, csharp
CSS css
Delphi delphi, pascal
Java java
Java Script js, jscript, javascript
PHP php
Python py, python
Ruby rb, ruby, rails, ror
Sql sql
VB vb, vb.net
XML/HTML xml, html, xhtml, xslt




Usage  How to use SyntaxHighlighter.

UsagePlacing the codePlace your code on the page and surround it with

 tag. Set name attribute to code and class attribute to one of the language aliases you wish to use. 
... some code here ...
NOTE: One important thing to watch out for is opening triangular bracket <. It must be replaced with an HTML equivalent of < in all cases. Failure to do won't break the page, but might break the source code displayed.
An alternative to
 is to use Extended configurationThere's a way to pass a few configuration options to the code block. It's done via colon separated arguments. 
... some code here ...
Making it workFinally, to get the whole thing to render properly on the page, you have to add JavaScript to the page.
type="text/css" rel="stylesheet" href="css/SyntaxHighlighter.css"><script language="javascript" src="js/shCore.js"></script><script language="javascript" src="js/shBrushCSharp.js"></script><script language="javascript" src="js/shBrushXml.js"></script><script language="javascript">dp.SyntaxHighlighter.ClipboardSwf = '/flash/clipboard.swf';dp.SyntaxHighlighter.HighlightAll('code');</script>For optimal result, place this code at the very end of your page. Check HighlightAll for more details about the function.



下载




















 FilenameSummary + LabelsUploadedSizeDownloadCount...
SyntaxHighlighter_1.5.1.rar 1.5.1  Featured Aug 0539.3 KB22152


本文转自
http://www.mikecat.net/space/viewspacepost.aspx?postid=52

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值