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="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></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">


0 Comments

Leave a Reply

Avatar placeholder

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