Sha256: 7c870701a14d8be08a298563e9e504ac988c19f25412f96d121a9feffdd39101

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

(function () {

	if (typeof self === 'undefined' || !self.Prism || !self.document || !Prism.languages.markup) {
		return;
	}

	Prism.plugins.UnescapedMarkup = true;

	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";
	});

	Prism.hooks.add('before-sanity-check', function (env) {
		if (env.language != "markup") {
			return;
		}

		if (env.element.matches("script[type='text/plain']")) {
			var code = document.createElement("code");
			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);
			env.element.parentNode.replaceChild(pre, env.element);
			env.element = code;
			return;
		}

		var pre = env.element.parentNode;
		if (!env.code && pre && pre.nodeName.toLowerCase() == 'pre' &&
				env.element.childNodes.length && env.element.childNodes[0].nodeName == "#comment") {
			env.element.textContent = env.code = env.element.childNodes[0].textContent;
		}
	});
}());

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
prism-rails-1.6.0.3 vendor/assets/javascripts/prism-plugin/prism-unescaped-markup.js
prism-rails-1.6.0.2 vendor/assets/javascripts/prism-plugin/prism-unescaped-markup.js
prism-rails-1.6.0.1 vendor/assets/javascripts/prism-plugin/prism-unescaped-markup.js
prism-rails-1.5.1.2 vendor/assets/javascripts/prism-unescaped-markup.js
prism-rails-1.5.1 vendor/assets/javascripts/prism-unescaped-markup.js
prism-rails-1.5.0 vendor/assets/javascripts/prism-unescaped-markup.js