I've a contentEditable div, and I want to display the html script for the content of this div. I'm using a bootbox alert to display my code, and the Rainbow Plugin to highlight the syntax.
The is the code I'm using :
bootbox.alert('<pre><code data-language="html">'+ document.getElementById('editor').innerHTML + '</code></pre>');
I also used the xmp
tag and this script:
<pre><![CDATA[
This is a demo, tags like <p> will
appear literally.
]]></pre>
as shown in this article : How to display raw html code in PRE or something like it but without escaping it, but none of them has worked.
This is what I'm getting :
How can I solve this ?