SyntaxHighlighter (原名:dp.SyntaxHighlighter)是一套在浏览器上对各种代码进行语法着色的独立 JavaScript 库。格式化效果如下图所示:
这也是本站所使用的语法着色库。
详细了解:http://alexgorbatchev.com/SyntaxHighlighter/
演示:
- // SyntaxHighlighter makes your code snippets beautiful without tiring your servers.
- // http://alexgorbatchev.com
- var setArray = function(elems) {
- this.length = 0;
- push.apply(this, elems);
- return this;
- }