Moved my code to auto escape html to the right place
parent
0441c26be1
commit
b649c19af9
12
js/reveal.js
12
js/reveal.js
|
@ -235,18 +235,6 @@ var Reveal = (function(){
|
||||||
dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) );
|
dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//Auto scape code blocks
|
|
||||||
var cblocks = document.querySelectorAll("pre code");
|
|
||||||
|
|
||||||
if(cblocks.length) {
|
|
||||||
for(var i=0, len=cblocks.length; i<len; i++) {
|
|
||||||
var thisDom = cblocks[i];
|
|
||||||
var html = thisDom.innerHTML;
|
|
||||||
html = html.replace(/</g,"<").replace(/>/g,">");
|
|
||||||
thisDom.innerHTML = html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
element.innerHTML = element.innerHTML.trim();
|
element.innerHTML = element.innerHTML.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now escape html
|
||||||
|
element.innerHTML = element.innerHTML.replace(/</g,"<").replace(/>/g,">");
|
||||||
|
|
||||||
// re-highlight when focus is lost (for edited code)
|
// re-highlight when focus is lost (for edited code)
|
||||||
element.addEventListener( 'focusout', function( event ) {
|
element.addEventListener( 'focusout', function( event ) {
|
||||||
hljs.highlightBlock( event.currentTarget );
|
hljs.highlightBlock( event.currentTarget );
|
||||||
|
|
Loading…
Reference in New Issue