SyntaxHighlighter 3.0.83

Fork Me On GitHub
whats new?
SyntaxHighlighter is an open source Java Script client side code syntax highlighter.
donate download installation autoloader configuration @syntaxhighlight

API

SyntaxHighlighter.all()

The main highlight function that needs to be called after all scripts are loaded. The place on the page where it’s called from isn’t important because the actual execution is delayed until window is loaded.

Here’s a typical example of configuring the very minimal amount required for fully functional JavaScript syntax highlighting.

      <html>
      	<head>
      		<script type="text/javascript" src="/Scripts/shCore.js"></script> 
      		<script type="text/javascript" src="/Scripts/shBrushJScript.js"></script> 
      		<script type="text/javascript">
      			SyntaxHighlighter.all();
      		</script> 
      	</head>
      	<body>
      		<pre class="brush: js">
      			alert("hello");
      		</pre>
      	</body>
      </html>
      

SyntaxHighlighter API

SyntaxHighlighter is the top level object and contains a number of functionality and predefined variables.

NameTypeDescription
allFunctionStatic function which process all elements on the page and performs syntax highlighting.
HighlighterClassThe base class for a brush.
regexLibObjectCommonly used regular expressions.