I've got a presentation running with reveal.js and everything is working. I am writing some sample code and highlight.js is working well within my presentation. But, I want to incrementally display code. E.g., imagine that I'm explaining a function to you, and I show you the first step, and then want to show the subsequent steps. Normally, I would use fragments to incrementally display items, but it's not working in a code block.
So I have something like this:
<pre><code>
def python_function()
<span class="fragment">display this first</span>
<span class="fragment">now display this</span>
</code></pre>
But the <span>
elements are getting syntax-highlighted instead of read as HTML fragments. It looks something like this: https://i.stack.imgur.com/Xeuzi.jpg
FYI without the <span>
elements highlight.js reads this correctly as python, but with the <span>
, the language it detects is coffeescript.
Any ideas on how to have fragments inside a code block (or another way to simulate this) would be greatly appreciated.
` element and add `.highlight` to your `
– baylee Aug 23 '14 at 22:17` tag.
– meetamit Apr 26 '15 at 06:29