This is essentially just based on Google prettify which can be found here.

Stick the following code in the head of the page to load the javascript.

<script src=""></script>

And then put the code you’d like to prettify in the following tags.

<pre class="prettyprint lang-html"></pre>

If using this for HTML you need to replace all < symbols with < and all > with >, the language should also be set to html in the pre class tag otherwise it doesn’t seem to format the HTML code correctly (at least snippets of html code). Other languages can be specified as well.

<pre class="prettyprint lang-html">


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *