Based on example here I am trying to use w3codecolor for html syntax highlighting.
I have added reference to https://www.w3schools.com/w3css/4/w3.css
and https://www.w3schools.com/lib/w3codecolor.js
and then call w3CodeColor();
function
However instead of showing html, its actually renders html output
Note that my html has custom element that i want to render as it is.
Html
<div class="w3-panel w3-card w3-light-grey">
<h4>Example</h4>
<div class="w3-code htmlHigh notranslate">
<file label="Please select a file." name="myimage" storage="{{bucket}}" validation="filetypes:.pdf|.txt|.xlsx maxfilesize:12345"></file>
<dropdown label="Can you select a single state?" name="state">
<option label="" value=""></option>
<option label="Oklahoma" value="OK"></option>
<option label="Texas" value="TX"></option>
<option label="New York" value="NY"></option>
</dropdown>
<input id="firstname" name="firstname" />
</div>
UPDATE 1
As per the suggestion I have escaped html using jQuery and it seemed to be working. However it does not keep the tab indentation. Any suggestion on how to keep tab indent?
//escape
$(".w3-code").each(function (i, v) {
var $code = $(v);
$code.text($code.html());
w3CodeColor();
});