aboutsummaryrefslogtreecommitdiff
path: root/plugin/highlight
diff options
context:
space:
mode:
authorRaymond Camden <raymondcamden@gmail.com>2013-05-01 14:44:53 -0500
committerRaymond Camden <raymondcamden@gmail.com>2013-05-01 14:44:53 -0500
commitb649c19af95d0494aa2127eb2069d2a7f108ab72 (patch)
tree1e073d49e74f3915b3238f76ebcd759ca56edb36 /plugin/highlight
parent0441c26be1bc0df805db9313827309a08c98487a (diff)
downloadfreenode-live-2017-presentation-b649c19af95d0494aa2127eb2069d2a7f108ab72.tar
freenode-live-2017-presentation-b649c19af95d0494aa2127eb2069d2a7f108ab72.tar.gz
Moved my code to auto escape html to the right place
Diffstat (limited to 'plugin/highlight')
-rw-r--r--plugin/highlight/highlight.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugin/highlight/highlight.js b/plugin/highlight/highlight.js
index 6756359..5a6ad90 100644
--- a/plugin/highlight/highlight.js
+++ b/plugin/highlight/highlight.js
@@ -11,6 +11,9 @@
element.innerHTML = element.innerHTML.trim();
}
+ // Now escape html
+ element.innerHTML = element.innerHTML.replace(/</g,"&lt;").replace(/>/g,"&gt;");
+
// re-highlight when focus is lost (for edited code)
element.addEventListener( 'focusout', function( event ) {
hljs.highlightBlock( event.currentTarget );