aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorEric Weikl <eric.weikl@tngtech.com>2013-05-05 16:03:42 +0200
committerEric Weikl <eric.weikl@tngtech.com>2013-05-05 16:19:08 +0200
commit88eb0af776bce5e07a21d030142c335d3c77cab1 (patch)
tree79ed7753c1f19e8a62b260216fc697fc5e69283f /plugin
parent4d89687fdefcf58ea07c39015b300f9a0f43a222 (diff)
downloadperl-software-in-gnu-guix-88eb0af776bce5e07a21d030142c335d3c77cab1.tar
perl-software-in-gnu-guix-88eb0af776bce5e07a21d030142c335d3c77cab1.tar.gz
Allow override of HTML escaping in code blocks
This way, authors can use HTML for special formatting.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/highlight/highlight.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugin/highlight/highlight.js b/plugin/highlight/highlight.js
index 5a6ad90..3f3bea6 100644
--- a/plugin/highlight/highlight.js
+++ b/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 ) {