Browse Source

Allow override of HTML escaping in code blocks

This way, authors can use HTML for special formatting.
embed 2.4.0
Eric Weikl 12 years ago
parent
commit
88eb0af776
  1. 6
      plugin/highlight/highlight.js

6
plugin/highlight/highlight.js

@ -11,8 +11,10 @@
element.innerHTML = element.innerHTML.trim();
}
// Now escape html
element.innerHTML = element.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;");
// Now escape html unless prevented by author
if( ! element.hasAttribute( 'data-noescape' )) {
element.innerHTML = element.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;");
}
// re-highlight when focus is lost (for edited code)
element.addEventListener( 'focusout', function( event ) {

Loading…
Cancel
Save