Skip to content

Instantly share code, notes, and snippets.

@NickTomlin
Last active April 15, 2017 22:18
Show Gist options
  • Save NickTomlin/7813bcfb626ec9088377 to your computer and use it in GitHub Desktop.
Save NickTomlin/7813bcfb626ec9088377 to your computer and use it in GitHub Desktop.
Step through reveal.js code as fragments
// stolen from http://stackoverflow.com/a/25396283
// add this in the "callback" block of the highlight plugin definition
// https://github.com/hakimel/reveal.js/blob/master/index.html#L399
[].forEach.call( document.querySelectorAll( '.highlight' ), function( v, i ) {
hljs.highlightBlock(v);
});
<pre class="highlight">
<span class="highlight fragment" data-fragment-index="1">function () {</span>
<span class="highlight fragment" data-fragment-index="2">var self = this;</span>
<span class="highlight fragment" data-fragment-index="3">
function getForEvents () {
<span class="highlight featured-code">return Object.keys(_events).map(function (e) {</span>
return e;
});
}
</span>
<span class="highlight highlight-block fragment" data-fragment-index="1">}</span>
</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment