JS版语法高亮工具SyntaxHighlighter

很强大的工具包。
http://alexgorbatchev.com/wiki/SyntaxHighlighter

支持语言种类繁多:


  • ActionScript3          
  • Bash/shell        
  • C#        
  • C++        
  • CSS
  • Delphi        
  • Diff        
  • Groovy        
  • JavaScript
  • Java        
  • JavaFX        
  • Perl        
  • PHP
  • Plain Text        
  • PowerShell        
  • Python        
  • Ruby        
  • Scala        
  • SQL        
  • Visual Basic        
  • XML



支持各种插件:
ROR,Wordpress,TinyMCE,Joomla! 1.5,FCKEditor。。。

支持多个主题:


  • shThemeDefault.css
  • shThemeDjango.css
  • shThemeEmacs.css
  • shThemeFadeToGrey.css
  • shThemeMidnight.css
  • shThemeRDark.css



使用简单:

  1. <!-- Include required JS files -->
  2. <script type="text/javascript " src="syntaxhighlighter/src/shCore.js"></script>
  3. <!-- At least one brush, here we choose JS. You need to include a brush for every language you want to highlight -->
  4. <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.js"></script>

  5. <!-- Include *at least* the core style and default theme -->
  6. <link href="syntaxhighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />
  7. <link href="syntaxhighlighter/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />
复制代码
  1. <script type="text/javascript">
  2.      SyntaxHighlighter.all()
  3. </script>
复制代码

扩展性强,作者自己添加了Objective-C 语法支持。现已用于Finalist Race 考试系统。

Note:由于是使用正则来取词上色,所以大篇幅的text(比如10K)会严重影响性能。

你可能感兴趣的:(JavaScript,css,wordpress,tinymce,powershell)