I'm trying to display a html template as markup in a code block
<div>
<pre class="prettyprint lang-html">
<code>
<%= template %>
</code>
</pre>
</div>
But the template actually renders in the browser, rather than the markup displaying in a code block.
I've included the CDN script in my body tag
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
You still need to escape html entities to prevent them from being displayed on the page. &
, <
, and >
need to be changed to &
, <
, and >
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.