There is a common need to display code in HTML or even to display HTML code inside HTML, especially in technical documentation or blogs. This has been done far too many times by taking an image from a piece of formatted code and making it part of the page. The code in the image will probably not get picked up by search engines. Additionally, it can limit us to a specific page layout or even screen size, and with today's mobile revolution, that is just not an option.
The only requirement for this recipe is that the data that will be displayed needs to be properly escaped; this means that
<p>awesome </p> needs to be translated into
<p>awesome </p>. This can be done either on the server side or escaped ...