-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Website: Added basic usage for CDNs (#1924)
Per [suggestion](#1922 (comment)) by @foxycode, I added an example for the usage of Prism with CDNs.
- Loading branch information
1 parent
d673d70
commit 922ec55
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,6 +152,27 @@ <h1>Basic usage</h1> | |
<p>If you want to prevent any elements from being automatically highlighted, you can use the attribute <code>data-manual</code> on the <code><script></code> element you used for prism and use the <a href="extending.html#api">API</a>. | ||
Example:</p> | ||
<pre><code><script src="prism.js" data-manual></script></code></pre> | ||
<h2>Usage with CDNs</h2> | ||
|
||
<p>In combination with CDNs, we recommend using the <a href="plugins/autoloader">Autoloader plugin</a> which automatically loads languages when necessary.</p> | ||
|
||
<p>The setup of the Autoloader, will look like the following. You can also your own themes of course.</p> | ||
|
||
<pre><code><!DOCTYPE html> | ||
<html> | ||
<head> | ||
...</code> | ||
<code class="highlight"><link href="https://myCDN.com/[email protected]/themes/prism.css" rel="stylesheet" /></code> | ||
<code></head> | ||
<body> | ||
...</code> | ||
<code class="highlight" style="display: inline-block; outline-offset: .2em; margin-bottom: .2em;"> <script src="https://myCDN.com/[email protected]/components/prism-core.min.js"></script> | ||
<script src="https://myCDN.com/[email protected]/plugins/autoloader/prism-autoloader.min.js"></script> | ||
<script>Prism.plugins.autoloader.languages_path = 'https://myCDN.com/[email protected]/components/'</script></code> | ||
<code></body> | ||
</html></code></pre> | ||
|
||
<p>CDNs which provide PrismJS are e.g. <a href="https://cdnjs.com/libraries/prism">cdnjs</a> and <a href="https://www.jsdelivr.com/package/npm/prismjs">jsDelivr</a>.</p> | ||
|
||
<h2>Usage with Webpack, Browserify, & Other Bundlers</h2> | ||
|
||
|