Skip to content

Commit 206dc80

Browse files
Docs: Minor improvement (#2513)
1 parent 5ad6cb2 commit 206dc80

7 files changed

+38
-23
lines changed

components/prism-core.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ var _ = {
455455
*
456456
* The following hooks will be run:
457457
* 1. `before-highlightall`
458-
* 2. All hooks of {@link Prism.highlightElement} for each element.
458+
* 2. `before-all-elements-highlight`
459+
* 3. All hooks of {@link Prism.highlightElement} for each element.
459460
*
460461
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
461462
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
@@ -487,11 +488,14 @@ var _ = {
487488
* The following hooks will be run:
488489
* 1. `before-sanity-check`
489490
* 2. `before-highlight`
490-
* 3. All hooks of {@link Prism.highlight}. These hooks will only be run by the current worker if `async` is `true`.
491+
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
491492
* 4. `before-insert`
492493
* 5. `after-highlight`
493494
* 6. `complete`
494495
*
496+
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
497+
* the element's language.
498+
*
495499
* @param {Element} element The element containing the code.
496500
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
497501
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers

docs/Prism.hooks.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ <h2>
7373

7474
<dt class="tag-source">Source:</dt>
7575
<dd class="tag-source"><ul class="dummy"><li>
76-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line656">line 656</a>
76+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line660">line 660</a>
7777
</li></ul></dd>
7878

7979

@@ -152,7 +152,7 @@ <h4 class="name" id=".add"><span class="type-signature">(static) </span>add<span
152152

153153
<dt class="tag-source">Source:</dt>
154154
<dd class="tag-source"><ul class="dummy"><li>
155-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line671">line 671</a>
155+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line675">line 675</a>
156156
</li></ul></dd>
157157

158158

@@ -314,7 +314,7 @@ <h4 class="name" id=".run"><span class="type-signature">(static) </span>run<span
314314

315315
<dt class="tag-source">Source:</dt>
316316
<dd class="tag-source"><ul class="dummy"><li>
317-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line688">line 688</a>
317+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line692">line 692</a>
318318
</li></ul></dd>
319319

320320

docs/Prism.html

+8-5
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ <h4 class="name" id=".highlight"><span class="type-signature">(static) </span>hi
263263

264264
<dt class="tag-source">Source:</dt>
265265
<dd class="tag-source"><ul class="dummy"><li>
266-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line597">line 597</a>
266+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line601">line 601</a>
267267
</li></ul></dd>
268268

269269

@@ -676,7 +676,7 @@ <h4 class="name" id=".highlightAllUnder"><span class="type-signature">(static) <
676676

677677
<dt class="tag-source">Source:</dt>
678678
<dd class="tag-source"><ul class="dummy"><li>
679-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line466">line 466</a>
679+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line467">line 467</a>
680680
</li></ul></dd>
681681

682682

@@ -721,6 +721,7 @@ <h4 class="name" id=".highlightAllUnder"><span class="type-signature">(static) <
721721
<p>The following hooks will be run:</p>
722722
<ol>
723723
<li><code>before-highlightall</code></li>
724+
<li><code>before-all-elements-highlight</code></li>
724725
<li>All hooks of <a href="Prism.html#.highlightElement"><code>Prism.highlightElement</code></a> for each element.</li>
725726
</ol>
726727
</div>
@@ -910,7 +911,7 @@ <h4 class="name" id=".highlightElement"><span class="type-signature">(static) </
910911

911912
<dt class="tag-source">Source:</dt>
912913
<dd class="tag-source"><ul class="dummy"><li>
913-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line509">line 509</a>
914+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line513">line 513</a>
914915
</li></ul></dd>
915916

916917

@@ -955,11 +956,13 @@ <h4 class="name" id=".highlightElement"><span class="type-signature">(static) </
955956
<ol>
956957
<li><code>before-sanity-check</code></li>
957958
<li><code>before-highlight</code></li>
958-
<li>All hooks of <a href="Prism.html#.highlight"><code>Prism.highlight</code></a>. These hooks will only be run by the current worker if <code>async</code> is <code>true</code>.</li>
959+
<li>All hooks of <a href="Prism.html#.highlight"><code>Prism.highlight</code></a>. These hooks will be run by an asynchronous worker if <code>async</code> is <code>true</code>.</li>
959960
<li><code>before-insert</code></li>
960961
<li><code>after-highlight</code></li>
961962
<li><code>complete</code></li>
962963
</ol>
964+
<p>Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
965+
the element's language.</p>
963966
</div>
964967

965968

@@ -1154,7 +1157,7 @@ <h4 class="name" id=".tokenize"><span class="type-signature">(static) </span>tok
11541157

11551158
<dt class="tag-source">Source:</dt>
11561159
<dd class="tag-source"><ul class="dummy"><li>
1157-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line633">line 633</a>
1160+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line637">line 637</a>
11581161
</li></ul></dd>
11591162

11601163

docs/Token.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ <h4 class="name" id="Token"><span class="type-signature"></span>new Token<span c
8080

8181
<dt class="tag-source">Source:</dt>
8282
<dd class="tag-source"><ul class="dummy"><li>
83-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line722">line 722</a>
83+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line726">line 726</a>
8484
</li></ul></dd>
8585

8686

@@ -364,7 +364,7 @@ <h4 class="name" id="alias"><span class="type-signature"></span>alias<span class
364364

365365
<dt class="tag-source">Source:</dt>
366366
<dd class="tag-source"><ul class="dummy"><li>
367-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line749">line 749</a>
367+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line753">line 753</a>
368368
</li></ul></dd>
369369

370370

@@ -447,7 +447,7 @@ <h4 class="name" id="content"><span class="type-signature"></span>content<span c
447447

448448
<dt class="tag-source">Source:</dt>
449449
<dd class="tag-source"><ul class="dummy"><li>
450-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line741">line 741</a>
450+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line745">line 745</a>
451451
</li></ul></dd>
452452

453453

@@ -524,7 +524,7 @@ <h4 class="name" id="type"><span class="type-signature"></span>type<span class="
524524

525525
<dt class="tag-source">Source:</dt>
526526
<dd class="tag-source"><ul class="dummy"><li>
527-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line732">line 732</a>
527+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line736">line 736</a>
528528
</li></ul></dd>
529529

530530

docs/global.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ <h4 class="name" id="Grammar">Grammar</h4>
143143

144144
<dt class="tag-source">Source:</dt>
145145
<dd class="tag-source"><ul class="dummy"><li>
146-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1157">line 1157</a>
146+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1161">line 1161</a>
147147
</li></ul></dd>
148148

149149

@@ -274,7 +274,7 @@ <h4 class="name" id="GrammarToken">GrammarToken</h4>
274274

275275
<dt class="tag-source">Source:</dt>
276276
<dd class="tag-source"><ul class="dummy"><li>
277-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1136">line 1136</a>
277+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1140">line 1140</a>
278278
</li></ul></dd>
279279

280280

@@ -559,7 +559,7 @@ <h4 class="name" id="HighlightCallback"><span class="type-signature"></span>High
559559

560560
<dt class="tag-source">Source:</dt>
561561
<dd class="tag-source"><ul class="dummy"><li>
562-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1165">line 1165</a>
562+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1169">line 1169</a>
563563
</li></ul></dd>
564564

565565

@@ -713,7 +713,7 @@ <h4 class="name" id="HookCallback"><span class="type-signature"></span>HookCallb
713713

714714
<dt class="tag-source">Source:</dt>
715715
<dd class="tag-source"><ul class="dummy"><li>
716-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1175">line 1175</a>
716+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1179">line 1179</a>
717717
</li></ul></dd>
718718

719719

@@ -859,7 +859,7 @@ <h4 class="name" id="TokenStream">TokenStream</h4>
859859

860860
<dt class="tag-source">Source:</dt>
861861
<dd class="tag-source"><ul class="dummy"><li>
862-
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line754">line 754</a>
862+
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line758">line 758</a>
863863
</li></ul></dd>
864864

865865

docs/prism-core.js.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,8 @@ <h1 class="page-title">prism-core.js</h1>
508508
*
509509
* The following hooks will be run:
510510
* 1. `before-highlightall`
511-
* 2. All hooks of {@link Prism.highlightElement} for each element.
511+
* 2. `before-all-elements-highlight`
512+
* 3. All hooks of {@link Prism.highlightElement} for each element.
512513
*
513514
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
514515
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
@@ -540,11 +541,14 @@ <h1 class="page-title">prism-core.js</h1>
540541
* The following hooks will be run:
541542
* 1. `before-sanity-check`
542543
* 2. `before-highlight`
543-
* 3. All hooks of {@link Prism.highlight}. These hooks will only be run by the current worker if `async` is `true`.
544+
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
544545
* 4. `before-insert`
545546
* 5. `after-highlight`
546547
* 6. `complete`
547548
*
549+
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
550+
* the element's language.
551+
*
548552
* @param {Element} element The element containing the code.
549553
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
550554
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers

prism.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ var _ = {
460460
*
461461
* The following hooks will be run:
462462
* 1. `before-highlightall`
463-
* 2. All hooks of {@link Prism.highlightElement} for each element.
463+
* 2. `before-all-elements-highlight`
464+
* 3. All hooks of {@link Prism.highlightElement} for each element.
464465
*
465466
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
466467
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
@@ -492,11 +493,14 @@ var _ = {
492493
* The following hooks will be run:
493494
* 1. `before-sanity-check`
494495
* 2. `before-highlight`
495-
* 3. All hooks of {@link Prism.highlight}. These hooks will only be run by the current worker if `async` is `true`.
496+
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
496497
* 4. `before-insert`
497498
* 5. `after-highlight`
498499
* 6. `complete`
499500
*
501+
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
502+
* the element's language.
503+
*
500504
* @param {Element} element The element containing the code.
501505
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
502506
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers

0 commit comments

Comments
 (0)