为什么 Google Code Prettify 呈现实际代码

Why is Google Code Prettify rendering the actual code

我正在尝试将 html 模板显示为代码块中的标记

<div>
    <pre class="prettyprint lang-html">
        <code>
            <%= template %>
        </code>
    </pre>
</div>

但模板实际上呈现在浏览器中,而不是代码块中显示的标记。

我已将 CDN 脚本包含在我的 body 标签中

<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>

您仍然需要转义 html 实体以防止它们显示在页面上。 &<>需要改为&amp;&lt;&gt;