diff --git a/plugins/custom-class/index.html b/plugins/custom-class/index.html index 624c37bd94..f453e15f49 100644 --- a/plugins/custom-class/index.html +++ b/plugins/custom-class/index.html @@ -86,9 +86,9 @@
Feature functions must be called AFTER Prism and this plugin. For example:
<!-- 1. load prism -->
-<script src="prism.js"></script>
+<script src="prism.js"></script>
<!-- 2. load the plugin if you don't include it inside prism when download -->
-<script src="plugins/custom-class/custom-class.js"></script>
+<script src="plugins/custom-class/custom-class.js"></script>
<!-- 3. call the feature you want to use -->
<script>
Prism.plugins.customClass.map(myClassMap);
@@ -109,6 +109,7 @@ CSS Modules Usage:
import classMap from 'styles/editor-class-map.css';
Prism.plugins.customClass.map(classMap)
+ Note: This plugin only affects generated token elements (usually of the form span.token
). The classes of code
and pre
elements as well as all elements generated by other plugins (e.g. Toolbar elements and line number elements) will not be changed.
Input
-<pre class="language-javascript"><code>
+ <pre class="language-javascript"><code>
var foo = 'bar';
</code></pre>
@@ -129,18 +130,20 @@ Prefix and map classes
Prism.plugins.customClass.prefix('pr-');
Output
-<pre class="language-javascript"><code>
- <span class="pr-token pr-special-keyword">var</span>
+ <pre class="language-javascript"><code class="language-markup">
+ <span class="pr-token pr-special-keyword">var</span>
foo
- <span class="pr-token pr-operator">=</span>
- <span class="pr-token pr-my-string">'bar'</span>
- <span class="pr-token pr-punctuation">;</span>
+ <span class="pr-token pr-operator">=</span>
+ <span class="pr-token pr-my-string">'bar'</span>
+ <span class="pr-token pr-punctuation">;</span>
</code></pre>
+ Note that this plugin only affects tokens. The classes of the code
and pre
elements won't be prefixed.
+
Add new classes
Input
- <pre class="language-css"><code>
+ <pre class="language-css"><code>
a::after {
content: '\2b00 ';
opacity: .7;