Adds support for auto escaping HTML in code blocks.

This commit is contained in:
Raymond Camden 2013-05-01 14:29:56 -05:00
parent 247771e129
commit 0441c26be1
1 changed files with 12 additions and 0 deletions

View File

@ -235,6 +235,18 @@ var Reveal = (function(){
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,"&lt;").replace(/>/g,"&gt;");
thisDom.innerHTML = html;
}
}
}
/**