use prism-tomorrow.css

This commit is contained in:
CyC2018
2018-12-19 14:09:39 +08:00
parent 0f00bcacaf
commit e9e604e6a7
1747 changed files with 100462 additions and 0 deletions

View File

@ -0,0 +1,195 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="favicon.png" />
<title>Unescaped markup ▲ Prism plugins</title>
<base href="../.." />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<link rel="stylesheet" href="plugins/unescaped-markup/prism-unescaped-markup.css" data-noprefix />
<script src="prefixfree.min.js"></script>
<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
</head>
<body class="language-markup">
<header>
<div class="intro" data-src="templates/header-plugins.html" data-type="text/html"></div>
<h2>Unescaped markup</h2>
<p>Write markup without having to escape anything.</p>
</header>
<section>
<h1>How to use</h1>
<p>This plugin provides several methods of achieving the same thing:</p>
<ul>
<li>Instead of using <code>&lt;pre>&lt;code></code> elements, use <code>&lt;script type="text/plain"></code>
<pre><code>&lt;script type="text/plain" class="language-markup">
&lt;p>Example&lt;/p>
&lt;/script></code></pre>
</li>
<li>Use a HTML-comment to escape your code
<pre><code>&lt;pre class="language-markup">&lt;code>&lt;!--
&lt;p>Example&lt;/p>
-->&lt;/code>&lt;/pre></code></pre></li>
</ul>
</section>
<section>
<h1>Examples</h1>
<p>View source to see that the following didnt need escaping (except for <code>&lt;/script></code>, that does):</p>
<script type="text/plain"><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="favicon.png" />
<title>Keep markup Prism plugins</title>
<base href="../.." />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<script src="prefixfree.min.js">&lt;/script>
</head>
<body class="language-markup">
<header>
<div class="intro" data-src="templates/header-plugins.html" data-type="text/html"></div>
<h2>Unescaped markup</h2>
<p>Write markup without having to escape anything.</p>
</header>
<section>
<h1>How to use</h1>
<p>Instead of using <code>&lt;pre>&lt;code></code> elements, use <code>&lt;script type="text/plain"></code>:</p>
</section>
<section>
<h1>Examples</h1>
<p>With <code>&lt;script type="text/plain"></code>:</p>
<script type="text/plain"><div><span>Foo</span></div>&lt;/script>
</section>
<section>
<h1>FAQ</h1>
<p>Why not use the HTML <code>&lt;template></code> tag?</p>
<p>Because it is a PITA to get its <code>textContent</code> and needs to be pointlessly cloned.
Feel free to implement it yourself and send a pull request though, if you are so inclined.</p>
<p>Can I use this inline?</p>
<p>Not out of the box, because I figured its more of a hassle to type <code>&lt;script type="text/plain"></code> than escape the 1-2 <code>&lt;</code> characters you need to escape in inline code.
Also inline code is not as frequently copy-pasted, which was the major source of annoyance that got me to write this plugin.</p>
</section>
<footer data-src="templates/footer.html" data-type="text/html"></footer>
<script src="prism.js">&lt;/script>
<script src="plugins/unescaped-markup/prism-unescaped-markup.js">&lt;/script>
<script src="utopia.js">&lt;/script>
<script src="components.js">&lt;/script>
<script src="code.js">&lt;/script>
</body>
</html></script>
<p>The next example uses the HTML-comment method:</p>
<pre><code><!--<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="favicon.png" />
<title>Keep markup ▲ Prism plugins</title>
<base href="../.." />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<script src="prefixfree.min.js"></script>
</head>
<body class="language-markup">
<header>
<div class="intro" data-src="templates/header-plugins.html" data-type="text/html"></div>
<h2>Unescaped markup</h2>
<p>Write markup without having to escape anything.</p>
</header>
<section>
<h1>How to use</h1>
<p>Instead of using <code>&lt;pre>&lt;code></code> elements, use <code>&lt;script type="text/plain"></code>:</p>
</section>
<section>
<h1>Examples</h1>
<p>With <code>&lt;script type="text/plain"></code>:</p>
<script type="text/plain"><div><span>Foo</span></div></script>
</section>
<section>
<h1>FAQ</h1>
<p>Why not use the HTML <code>&lt;template></code> tag?</p>
<p>Because it is a PITA to get its <code>textContent</code> and needs to be pointlessly cloned.
Feel free to implement it yourself and send a pull request though, if you are so inclined.</p>
<p>Can I use this inline?</p>
<p>Not out of the box, because I figured its more of a hassle to type <code>&lt;script type="text/plain"></code> than escape the 1-2 <code>&lt;</code> characters you need to escape in inline code.
Also inline code is not as frequently copy-pasted, which was the major source of annoyance that got me to write this plugin.</p>
</section>
<footer data-src="templates/footer.html" data-type="text/html"></footer>
<script src="prism.js"></script>
<script src="plugins/unescaped-markup/prism-unescaped-markup.js"></script>
<script src="utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
</body>
</html>--></code></pre>
</section>
<section>
<h1>FAQ</h1>
<p>Why not use the HTML <code>&lt;template></code> tag?</p>
<p>Because it is a PITA to get its <code>textContent</code> and needs to be pointlessly cloned.
Feel free to implement it yourself and send a pull request though, if you are so inclined.</p>
<p>Can I use this inline?</p>
<p>Not out of the box, because I figured its more of a hassle to type <code>&lt;script type="text/plain"></code> than escape the 1-2 <code>&lt;</code> characters you need to escape in inline code.
Also inline code is not as frequently copy-pasted, which was the major source of annoyance that got me to write this plugin.</p>
</section>
<footer data-src="templates/footer.html" data-type="text/html"></footer>
<script src="prism.js"></script>
<script src="plugins/unescaped-markup/prism-unescaped-markup.js"></script>
<script src="utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
</body>
</html>

View File

@ -0,0 +1,10 @@
/* Fallback, in case JS does not run, to ensure the code is at least visible */
[class*='lang-'] script[type='text/plain'],
[class*='language-'] script[type='text/plain'],
script[type='text/plain'][class*='lang-'],
script[type='text/plain'][class*='language-'] {
display: block;
font: 100% Consolas, Monaco, monospace;
white-space: pre;
overflow: auto;
}

View File

@ -0,0 +1,44 @@
(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 += ", [class*='lang-'] script[type='text/plain'], [class*='language-'] script[type='text/plain']" +
", script[type='text/plain'][class*='lang-'], script[type='text/plain'][class*='language-']";
});
Prism.hooks.add('before-sanity-check', function (env) {
if ((env.element.matches || env.element.msMatchesSelector).call(env.element, "script[type='text/plain']")) {
var code = document.createElement("code");
var pre = document.createElement("pre");
pre.className = code.className = env.element.className;
if (env.element.dataset) {
Object.keys(env.element.dataset).forEach(function (key) {
if (Object.prototype.hasOwnProperty.call(env.element.dataset, key)) {
pre.dataset[key] = env.element.dataset[key];
}
});
}
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;
}
});
}());

View File

@ -0,0 +1 @@
!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.languages.markup&&(Prism.plugins.UnescapedMarkup=!0,Prism.hooks.add("before-highlightall",function(e){e.selector+=", [class*='lang-'] script[type='text/plain'], [class*='language-'] script[type='text/plain'], script[type='text/plain'][class*='lang-'], script[type='text/plain'][class*='language-']"}),Prism.hooks.add("before-sanity-check",function(e){if((e.element.matches||e.element.msMatchesSelector).call(e.element,"script[type='text/plain']")){var t=document.createElement("code"),n=document.createElement("pre");return n.className=t.className=e.element.className,e.element.dataset&&Object.keys(e.element.dataset).forEach(function(t){Object.prototype.hasOwnProperty.call(e.element.dataset,t)&&(n.dataset[t]=e.element.dataset[t])}),e.code=e.code.replace(/&lt;\/script(>|&gt;)/gi,"</script>"),t.textContent=e.code,n.appendChild(t),e.element.parentNode.replaceChild(n,e.element),e.element=t,void 0}var n=e.element.parentNode;!e.code&&n&&"pre"==n.nodeName.toLowerCase()&&e.element.childNodes.length&&"#comment"==e.element.childNodes[0].nodeName&&(e.element.textContent=e.code=e.element.childNodes[0].textContent)}))}();