Search code examples
htmlprism.js

Writing html tags inside html


I am writing a blog where I need to explain HTML tags. However, I am using HTML to make the blog and need away to get html written inside html. I am using prism.js to give the html syntax highlighting

<pre class="language-html"> <script src="node_modules/three/build/three.min.js"></script</pre>

Solution

  • Replace < with &lt; and > with &gt;

    Example:

    <h1>This is a normal html element!</h1>
    
    &lt;h1&gt;This is not!&lt;/h1&gt;