Wiki

Clone wiki

beautyOfCode for HTML5 / Home

Welcome

http://logue.be/JavaScript/jQuery/beautyOfCode

This fork uses data- attribute.

Usage

First, insert these HTML before </body> tag.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="../javascript/jquery.beautyOfCode.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function(){
	$.beautyOfCode.beautifyAll();
});
/*]]>*/</script>

Second, Add the class="code" to <pre> want syntax highlighting tags. If you want to specify the language into a language name to the attribute data-brush.

<pre class="code" data-brush="php">
	<strong style="font-weight: normal"><?= str_replace("\n", "<br/>", $var) ?></strong>
</pre>

The brush script (such as data-brush), data contained in the page-load and automatically determine the value of the brush. Therefore, the need to specify the brush is not explicitly load the script.

Limitation

This fork does not compatible with SyntaxHilighter 3.x

Updated