SyntaxHighlighter

SyntaxHighlighter is a fully functional self-contained code syntax highlighter developed in JavaScript. Once installed, it adds markup of the form:

(:code PARAMETERS:)[@
source code
@]
      or      (:code PARAMETERS:)
source
(:codeend:)

Demonstration

Example HTML code with embedded PHP script: CodeBlockMarkup($pagename, PSS($m[1]), PSS($m[3]))

If JavaScript is disabled it will look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<title>SyntaxHighlighter Demo</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<body>
	<div style="font-weight: bold"><?= str_replace("\n", "<br/>", $var) ?></div>

	<?
	/***********************************
	 ** Multiline block comments
	 **********************************/

	$stringWithUrl = "http://alexgorbatchev.com";
	$stringWithUrl = 'http://alexgorbatchev.com';

	ob_start("parseOutputBuffer");		// Start Code Buffering
	session_start();
	?>
</body>
</html>

Parameters

ParameterDefault ValueDescription
auto_linkstrueAllows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won't be clickable.
collapsefalseAllows you to force highlighted elements on the page to be collapsed by default.
first_line1Allows you to change the first (starting) line number.
guttertrueAllows you to turn gutter with line numbers on and off.
highlightnullAllows you to highlight one or more lines to focus user's attention. When specifying as a parameter, you have to pass an array looking value, like [1, 2, 3] or just an number for a single line.
html_scriptfalseAllows you to highlight a mixture of HTML/XML code and a script which is very common in web development. Setting this value to true requires that the brush you are using supports this feature.
lightfalseAllows you to disable toolbar and gutter with a single property.
rulerfalseAllows you to show column ruler on top of highlighted elements.
smart_tabstrueAllows you to turn smart tabs feature on and off.
tab_size4Allows you to adjust tab size.
toolbartrueToggles toolbar on/off.
langplainSelects the language.
wrap_linestrueAllows you to turn line wrapping feature on and off.

Supported Languages

Brush NameBrush Aliases
ActionScript3as3, actionscript3
Bash/Shellbash, shell
ColdFusioncf, coldfusion
C#c-sharp, csharp
C++cpp, c
CSScss
Delphidelphi, pas, pascal
Diffdiff, patch
Erlangerl, erlang
Groovygroovy
JavaScriptjs, jscript, javascript
Javajava
JavaFXjfx, javafx
Perlperl, pl
PHPphp
Plain Textplain, text
PowerShellps, powershell
Pythonpy, python
Rubyrails, ror, ruby
Scalascala
SQLsql
Visual Basicvb, vbnet
XMLxml, xslt, html, xhtml