Commit ad30c323cd00900496882b4cc82a5ead34d4eb1c

Lea Verou 2016-02-14T21:25:57

[unescaped markup] Fixed bug with escaped </script>

diff --git a/plugins/unescaped-markup/prism-unescaped-markup.js b/plugins/unescaped-markup/prism-unescaped-markup.js
index 1a13b8e..9ed0e1a 100644
--- a/plugins/unescaped-markup/prism-unescaped-markup.js
+++ b/plugins/unescaped-markup/prism-unescaped-markup.js
@@ -6,7 +6,7 @@
 
 	Prism.plugins.UnescapedMarkup = true;
 
-	Prism.hooks.add('before-highlightall', function (env) { console.log(env);
+	Prism.hooks.add('before-highlightall', function (env) {
 		env.selector += ", .lang-markup script[type='text/plain'], .language-markup script[type='text/plain']" +
 		                ", script[type='text/plain'].lang-markup, script[type='text/plain'].language-markup";
 	});
@@ -21,6 +21,8 @@
 			var pre = document.createElement("pre");
 
 		    pre.className = code.className = env.element.className;
+
+			env.code = env.code.replace(/&lt;\/script(>|&gt;)/gi, "</scri" + "pt>");
 			code.textContent = env.code;
 
 		    pre.appendChild(code);
diff --git a/plugins/unescaped-markup/prism-unescaped-markup.min.js b/plugins/unescaped-markup/prism-unescaped-markup.min.js
index faf9f9b..e95fab3 100644
--- a/plugins/unescaped-markup/prism-unescaped-markup.min.js
+++ b/plugins/unescaped-markup/prism-unescaped-markup.min.js
@@ -1 +1 @@
-!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.languages.markup&&(Prism.plugins.UnescapedMarkup=!0,Prism.hooks.add("before-highlightall",function(e){console.log(e),e.selector+=", .lang-markup script[type='text/plain'], .language-markup script[type='text/plain'], script[type='text/plain'].lang-markup, script[type='text/plain'].language-markup"}),Prism.hooks.add("before-highlight",function(e){if("markup"==e.language&&e.element.matches("script[type='text/plain']")){var t=document.createElement("code"),a=document.createElement("pre");return a.className=t.className=e.element.className,t.textContent=e.code,a.appendChild(t),e.element.parentNode.replaceChild(a,e.element),e.element=t,void 0}}))}();
\ No newline at end of file
+!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.languages.markup&&(Prism.plugins.UnescapedMarkup=!0,Prism.hooks.add("before-highlightall",function(e){e.selector+=", .lang-markup script[type='text/plain'], .language-markup script[type='text/plain'], script[type='text/plain'].lang-markup, script[type='text/plain'].language-markup"}),Prism.hooks.add("before-highlight",function(e){if("markup"==e.language&&e.element.matches("script[type='text/plain']")){var t=document.createElement("code"),a=document.createElement("pre");return a.className=t.className=e.element.className,e.code=e.code.replace(/&lt;\/script(>|&gt;)/gi,"</script>"),t.textContent=e.code,a.appendChild(t),e.element.parentNode.replaceChild(a,e.element),e.element=t,void 0}}))}();
\ No newline at end of file