简体   繁体   中英

Why is Google Code Prettify rendering the actual code

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 &amp; , &lt; , and &gt; .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM