Allow override of HTML escaping in code blocks 2.4.0
authorEric Weikl <eric.weikl@tngtech.com>
Sun, 5 May 2013 14:03:42 +0000 (16:03 +0200)
committerEric Weikl <eric.weikl@tngtech.com>
Sun, 5 May 2013 14:19:08 +0000 (16:19 +0200)
This way, authors can use HTML for special formatting.

plugin/highlight/highlight.js

index 5a6ad903fd82236d4e17f6115f132d15450f6e70..3f3bea60ce8fea8d4d05b05e1b5a5fe3da069aa0 100644 (file)
                                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 ) {