Sample Data
<script type="syntaxhighlighter" class="brush: js"><![CDATA[ /** * SyntaxHighlighter */ function foo() { if (counter <= 10) return; // it works! } ]]></script>
Will render as:
/** * SyntaxHighlighter */ function foo(){if (counter <= 10)return; // it works! }
Introduction
Writing By Alex Gorbatchev this code occurs you to highlight different langages in a normal html Page. Langages are call brushes, and theme are used to change the look of your page. You can easely modify a theme by changing directly parameters in a theme file.Installation
-
1 - Add main files to your page: shCore.js and shCore.css
<link href="your_path/shCore.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="your_path/shCore.js"></script>2 - Add brushes that you want (for example, shBrushCss.js for Css)
<script type="text/javascript" src="your_path/shBrushCss.js"></script>3 - Include shCore.css and shThemeDefault.css
4 - Create a code snippet with either <pre /> or <script /> method (see below)
5 - Call SyntaxHighlighter.all() JavaScript method