This is essentially just based on Google prettify which can be found here.
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">