reveal.js and hilightjs - how to stop my tags from

2019-08-23 10:31发布

问题:

I am making a presentation using reveal.js

I want to display the following in a nice syntax highlighted code block:

<foo>

So in my presentation html I do this:

<pre><code class="hljs" data-trim contenteditable>
<foo>
</code></pre>

This is what gets displayed instead:

<foo>
</foo>

How do I stop my tags from getting closed for me?

回答1:

This works:

<pre><code class="hljs" data-trim contenteditable>
&ltfoo>
</code></pre>