Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website: Added script directory #1781

Merged
merged 1 commit into from
Mar 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions download.html
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@
border-bottom-left-radius: 0;
}
</style>
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -169,12 +169,12 @@ <h2>Customize your download</h2>

<footer data-src="templates/footer.html" data-type="text/html"></footer>

<script src="scripts/utopia.js"></script>
<script src="prism.js"></script>
<script src="utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="vendor/promise.js"></script>
<script src="download.js"></script>
<script src="scripts/code.js"></script>
<script src="scripts/vendor/promise.js"></script>
<script src="scripts/download.js"></script>

</body>
</html>
10 changes: 5 additions & 5 deletions examples.html
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
padding-left: 40px;
}
</style>
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -99,12 +99,12 @@ <h1>Per language examples</h1>

<footer data-src="templates/footer.html" data-type="text/html"></footer>

<script src="scripts/utopia.js"></script>
<script src="prism.js"></script>
<script src="utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="vendor/promise.js"></script>
<script src="examples.js"></script>
<script src="scripts/code.js"></script>
<script src="scripts/vendor/promise.js"></script>
<script src="scripts/examples.js"></script>

</body>
</html>
6 changes: 3 additions & 3 deletions extending.html
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<title>Extending Prism ▲ Prism</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -238,10 +238,10 @@ <h2>Returns</h2>

<footer data-src="templates/footer.html" data-type="text/html"></footer>

<script src="scripts/utopia.js"></script>
<script src="prism.js"></script>
<script src="utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>

</body>
</html>
36 changes: 18 additions & 18 deletions faq.html
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
color: black;
}
</style>
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -25,33 +25,33 @@

<header>
<div class="intro" data-src="templates/header-main.html" data-type="text/html"></div>

<h2>FAQ</h2>
<p>Frequently Asked Questions, with a few Questions I want people to Frequently Ask.</p>
</header>

<section>
<h1>This page doesn’t work in Opera!</h1>

<p><strong>Prism works fine in Opera.</strong> However, this page might sometimes appear to not be working in Opera, due to the theme switcher triggering an Opera bug.
This will be fixed soon.</p>
</section>

<section>
<h1>Isn’t it bad to do syntax highlighting with regular expressions?</h1>
<p>It is true that to correctly handle every possible case of syntax found in the wild, one would need to write a full-blown parser.

<p>It is true that to correctly handle every possible case of syntax found in the wild, one would need to write a full-blown parser.
However, in most web applications and websites a small error margin is usually acceptable and a rare highlighting failure is not the end of the world.
A syntax highlighter based on regular expressions might only be accurate 99% of the time (the actual percentage is just a guess),
but in exchange for the small error margin, it offers some very important benefits:

<ul>
<li>Smaller filesize. Proper parsers are very big.</li>
<li>Extensibility. Authors can define new languages simply by knowing how to code regular expressions.
<li>Extensibility. Authors can define new languages simply by knowing how to code regular expressions.
Writing a correct, unambiguous BNF grammar is a task at least an order of magnitude harder.</li>
<li>Graceful error recovery. Parsers fail on incorrect syntax, where regular expressions keep matching.</li>
</ul>

<p>For this reason, most syntax highlighters on the web and on desktop, are powered by regular expressions. This includes the internal syntax
highlighters used by popular native applications like Espresso and Sublime Text, at the time of writing.
Of course, not every regex-powered syntax highlighter is created equal. The number and type of failures can be vastly different, depending on
@@ -60,35 +60,35 @@ <h1>Isn’t it bad to do syntax highlighting with regular expressions?</h1>

<section>
<h1>Why is asynchronous highlighting disabled by default?</h1>

<p>Web Workers are good for preventing syntax highlighting of really large code blocks from blocking the main UI thread.
In most cases, you will want to highlight reasonably sized chunks of code, and this will not be needed.
Furthermore, using Web Workers is actually <strong>slower</strong> than synchronously highlighting, due to the overhead of creating and terminating
the Worker. It just appears faster in these cases because it doesn’t block the main thread.
In addition, since Web Workers operate on files instead of objects, plugins that hook on core parts of Prism (e.g. modify language definitions)
In addition, since Web Workers operate on files instead of objects, plugins that hook on core parts of Prism (e.g. modify language definitions)
will not work unless included in the same file (using the builder in the <a href="download.html">Download</a> page will protect you from this pitfall).
Lastly, Web Workers cannot interact with the DOM and most other APIs (e.g. the console), so they are notoriously hard to debug.
</p>
</section>

<section>
<h1>Why is pre-existing HTML stripped off?</h1>
<p>Because it would complicate the code a lot, although it’s not a crucial feature for most people.

<p>Because it would complicate the code a lot, although it’s not a crucial feature for most people.
If it’s very important to you, you can use the <a href="plugins/keep-markup/">Keep Markup plugin</a>.</p>
</section>

<section>
<h1>If pre-existing HTML is stripped off, how can I highlight certain parts of the code?</h1>

<p>There is a number of ways around it. You can always break the block of code into multiple parts, and wrap the HTML around it (or just use a <code>.highlight</code> class).
You can see an example of this in action at the “<a href="index.html#basic-usage">Basic usage</a>” section of the homepage.</p>
<p>Another way around the limitation is to use the <a href="plugins/line-highlight/">Line Highlght plugin</a>, to highlight and link to specific lines and/or line ranges.
</section>

<section>
<h1>How do I know which tokens I can style for every language?</h1>

<p>Every token that is highlighted gets two classes: <code>token</code> and a class with the token type (e.g. <code>comment</code>).
You can find the different types of tokens either by looking at the keys of the object defining the language or by running this snippet in the console:
<pre><code class="language-javascript">function printTokens(o, prefix) { for (var i in o) { console.log((prefix? prefix + ' > ' : '') + i); if (o[i].inside) printTokens(o[i].inside, (prefix? prefix + ' > ' : '') + i); } };</code></pre>
@@ -135,7 +135,7 @@ <h1>How do I know which tokens I can style for every language?</h1>

<section>
<h1>How can I use different highlighting for tokens with the same name in different languages?</h1>
<p>Just use a descendant selector, that includes the language class. The default <code>prism.css</code> does this, to have different colors for
<p>Just use a descendant selector, that includes the language class. The default <code>prism.css</code> does this, to have different colors for
JavaScript strings (which are very common) and CSS strings (which are relatively rare). Here’s that code, simplified to illustrate the technique:
<pre><code class="language-css">
.token.string {
@@ -159,8 +159,9 @@ <h1>How can I use different highlighting for tokens with the same name in differ

<footer data-src="templates/footer.html" data-type="text/html"></footer>

<script src="scripts/utopia.js"></script>
<script src="prism.js"></script>
<script src="utopia.js"></script>
<script src="components.js"></script>
<script>
$$('section > h1').forEach(function (h1) {
$u.element.create('p', {
@@ -175,8 +176,7 @@ <h1>How can I use different highlighting for tokens with the same name in differ
});
});
</script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>

</body>
</html>
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
<title>Prism</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -259,10 +259,10 @@ <h1>Credits</h1>

<footer data-src="templates/footer.html" data-type="text/html"></footer>

<script src="scripts/utopia.js"></script>
<script src="prism.js"></script>
<script src="utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>
<script>
(function() {
var languageItems = [];
8 changes: 4 additions & 4 deletions plugins/autolinker/index.html
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<link rel="stylesheet" href="plugins/autolinker/prism-autolinker.css" data-noprefix />
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -61,10 +61,10 @@ <h2>HTML</h2>

<script src="prism.js"></script>
<script src="plugins/autolinker/prism-autolinker.js"></script>
<script src="utopia.js"></script>
<script src="scripts/utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>


</body>
</html>
</html>
6 changes: 3 additions & 3 deletions plugins/autoloader/index.html
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
content: ' [Generating... ' attr(data-progress) '%]';
}
</style>
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -121,9 +121,9 @@ <h1>Examples</h1>

<script src="components/prism-core.js"></script>
<script src="plugins/autoloader/prism-autoloader.js" data-autoloader-path="components"></script>
<script src="utopia.js"></script>
<script src="scripts/utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>

<script src="vendor/promise.js"></script>
<script src="vendor/jszip.min.js"></script>
8 changes: 4 additions & 4 deletions plugins/command-line/index.html
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<link rel="stylesheet" href="plugins/command-line/prism-command-line.css" data-noprefix />
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -101,11 +101,11 @@ <h2>Windows PowerShell With Output</h2>

<script src="prism.js"></script>
<script src="plugins/command-line/prism-command-line.js"></script>
<script src="utopia.js"></script>
<script src="scripts/utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>
<script src="components/prism-bash.js"></script>
<script src="components/prism-powershell.js"></script>

</body>
</html>
</html>
8 changes: 4 additions & 4 deletions plugins/copy-to-clipboard/index.html
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<link rel="stylesheet" href="plugins/toolbar/prism-toolbar.css" data-noprefix />
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -40,9 +40,9 @@ <h1>How to use</h1>
<script src="prism.js"></script>
<script src="plugins/toolbar/prism-toolbar.js"></script>
<script src="plugins/copy-to-clipboard/prism-copy-to-clipboard.js"></script>
<script src="utopia.js"></script>
<script src="scripts/utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>

</body>
</html>
</html>
8 changes: 4 additions & 4 deletions plugins/custom-class/index.html
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
<base href="../.." />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<script src="prefixfree.min.js"></script>
<script src="scripts/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>
@@ -18,7 +18,7 @@
<div class="intro" data-src="templates/header-plugins.html" data-type="text/html"></div>

<h2>Custom Class</h2>
<p>This plugin allows you to prefix Prism default classes (<code>.comment</code> will become <code>.namespace--comment</code>) or replace them with your defined ones (like <code>.editor__comment</code> or <code>.comment_7sh3a</code>).</p>
<p>This plugin allows you to prefix Prism default classes (<code>.comment</code> will become <code>.namespace--comment</code>) or replace them with your defined ones (like <code>.editor__comment</code> or <code>.comment_7sh3a</code>).</p>
</header>

<section>
@@ -125,9 +125,9 @@ <h1>Todo</h1>

<script src="prism.js"></script>
<script src="plugins/custom-class/prism-custom-class.js"></script>
<script src="utopia.js"></script>
<script src="scripts/utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>

</body>
</html>
10 changes: 5 additions & 5 deletions plugins/data-uri-highlight/index.html
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<link rel="stylesheet" href="plugins/autolinker/prism-autolinker.css" data-noprefix />
<script src="prefixfree.min.js"></script>
<script src="scripts/prefixfree.min.js"></script>

<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
@@ -31,7 +31,7 @@ <h1>How to use</h1>

<section>
<h1>Example</h1>

<pre><code class="language-css">div {
border: 40px solid transparent;
border-image: 33.334% url('data:image/svg+xml,&lt;svg xmlns="http://www.w3.org/2000/svg" width="30" height="30"> \
@@ -51,10 +51,10 @@ <h1>Example</h1>

<script src="prism.js"></script>
<script src="plugins/data-uri-highlight/prism-data-uri-highlight.js"></script>
<script src="utopia.js"></script>
<script src="scripts/utopia.js"></script>
<script src="components.js"></script>
<script src="code.js"></script>
<script src="scripts/code.js"></script>


</body>
</html>
</html>
Loading