Debian Codegraph @

docs/global.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4
5 <meta charset="utf-8">
6 <title>Global - Documentation</title>
7
8
9 <meta property="og:title" content="Prism generated API documentation"/>
10 <meta property="og:type" content="website"/>
11 <meta property="og:image" content="/logo.svg"/>
12 <meta property="og:site_name" content="Prism"/>
13 <meta property="og:url" content="https://prismjs.com"/>
14
15 <script src="scripts/prettify/prettify.js"></script>
16 <script src="scripts/prettify/lang-css.js"></script>
17 <!--[if lt IE 9]>
18 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
19 <![endif]-->
20 <link type="text/css" rel="stylesheet" href="styles/prettify.css">
21 <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
22 <script src="scripts/nav.js" defer></script>
23 <meta name="viewport" content="width=device-width, initial-scale=1.0">
24 <link rel="icon" type="image/png" href="/favicon.png"/>
25 </head>
26 <body>
27
28 <input type="checkbox" id="nav-trigger" class="nav-trigger" />
29 <label for="nav-trigger" class="navicon-button x">
30 <div class="navicon"></div>
31 </label>
32
33 <label for="nav-trigger" class="overlay"></label>
34
35 <nav >
36
37 <input type="text" id="nav-search" placeholder="Search" />
38
39 <h2><a href="index.html">Home</a></h2><h2><a href="https://prismjs.com" class="menu-item" id="website_link" >PrismJS</a></h2><h2><a href="https://github.com/PrismJS/prism" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="Token.html">Token</a></li></ul><h3>Namespaces</h3><ul><li><a href="Prism.html">Prism</a><ul class='members'><li data-type='member'><a href="Prism.html#.disableWorkerMessageHandler">disableWorkerMessageHandler</a></li><li data-type='member'><a href="Prism.html#.manual">manual</a></li></ul><ul class='methods'><li data-type='method'><a href="Prism.html#.highlight">highlight</a></li><li data-type='method'><a href="Prism.html#.highlightAll">highlightAll</a></li><li data-type='method'><a href="Prism.html#.highlightAllUnder">highlightAllUnder</a></li><li data-type='method'><a href="Prism.html#.highlightElement">highlightElement</a></li><li data-type='method'><a href="Prism.html#.tokenize">tokenize</a></li></ul></li><li><a href="Prism.hooks.html">hooks</a><ul class='methods'><li data-type='method'><a href="Prism.hooks.html#.add">add</a></li><li data-type='method'><a href="Prism.hooks.html#.run">run</a></li></ul></li><li><a href="Prism.languages.html">languages</a><ul class='methods'><li data-type='method'><a href="Prism.languages.html#.extend">extend</a></li><li data-type='method'><a href="Prism.languages.html#.insertBefore">insertBefore</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Grammar">Grammar</a></li><li><a href="global.html#GrammarToken">GrammarToken</a></li><li><a href="global.html#HighlightCallback">HighlightCallback</a></li><li><a href="global.html#HookCallback">HookCallback</a></li><li><a href="global.html#TokenStream">TokenStream</a></li></ul>
40 </nav>
41
42 <div id="main">
43
44 <h1 class="page-title">Global</h1>
45
46
47
48
49
50
51
52 <section>
53
54 <header>
55
56 <h2>
57
58 </h2>
59
60
61 </header>
62
63 <article>
64
65 <div class="container-overview">
66
67
68
69 <dl class="details">
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102 </dl>
103
104
105
106
107
108
109
110
111 </div>
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131 <h3 class="subsection-title">Type Definitions</h3>
132
133
134
135 <h4 class="name" id="Grammar">Grammar</h4>
136
137
138
139
140
141 <dl class="details">
142
143
144 <dt class="tag-source">Source:</dt>
145 <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#line1239">line 1239</a>
147 </li></ul></dd>
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179 </dl>
180
181
182
183 <h5 class="subsection-title">Properties:</h5>
184
185
186
187 <table class="props">
188 <thead>
189 <tr>
190
191 <th>Name</th>
192
193
194 <th>Type</th>
195
196
197 <th>Attributes</th>
198
199
200
201
202 <th class="last">Description</th>
203 </tr>
204 </thead>
205
206 <tbody>
207
208
209 <tr>
210
211 <td class="name"><code>rest</code></td>
212
213
214 <td class="type">
215
216
217 <span class="param-type"><a href="global.html#Grammar">Grammar</a></span>
218
219
220
221 </td>
222
223
224 <td class="attributes">
225
226 &lt;optional><br>
227
228
229
230 </td>
231
232
233
234
235 <td class="description last"><p>An optional grammar object that will be appended to this grammar.</p></td>
236 </tr>
237
238
239 </tbody>
240 </table>
241
242
243
244
245
246
247
248
249 <h5>Type:</h5>
250 <ul>
251 <li>
252
253 <span class="param-type">Object.&lt;string, (RegExp|<a href="global.html#GrammarToken">GrammarToken</a>|Array.&lt;(RegExp|<a href="global.html#GrammarToken">GrammarToken</a>)>)></span>
254
255
256 </li>
257 </ul>
258
259
260
261
262
263
264
265
266 <h4 class="name" id="GrammarToken">GrammarToken</h4>
267
268
269
270
271
272 <dl class="details">
273
274
275 <dt class="tag-source">Source:</dt>
276 <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#line1218">line 1218</a>
278 </li></ul></dd>
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310 </dl>
311
312
313
314 <h5 class="subsection-title">Properties:</h5>
315
316
317
318 <table class="props">
319 <thead>
320 <tr>
321
322 <th>Name</th>
323
324
325 <th>Type</th>
326
327
328 <th>Attributes</th>
329
330
331
332 <th>Default</th>
333
334
335 <th class="last">Description</th>
336 </tr>
337 </thead>
338
339 <tbody>
340
341
342 <tr>
343
344 <td class="name"><code>pattern</code></td>
345
346
347 <td class="type">
348
349
350 <span class="param-type">RegExp</span>
351
352
353
354 </td>
355
356
357 <td class="attributes">
358
359
360
361 </td>
362
363
364
365 <td class="default">
366
367 </td>
368
369
370 <td class="description last"><p>The regular expression of the token.</p></td>
371 </tr>
372
373
374
375 <tr>
376
377 <td class="name"><code>lookbehind</code></td>
378
379
380 <td class="type">
381
382
383 <span class="param-type">boolean</span>
384
385
386
387 </td>
388
389
390 <td class="attributes">
391
392 &lt;optional><br>
393
394
395
396 </td>
397
398
399
400 <td class="default">
401
402 <code>false</code>
403
404 </td>
405
406
407 <td class="description last"><p>If <code>true</code>, then the first capturing group of <code>pattern</code> will (effectively)
408 behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.</p></td>
409 </tr>
410
411
412
413 <tr>
414
415 <td class="name"><code>greedy</code></td>
416
417
418 <td class="type">
419
420
421 <span class="param-type">boolean</span>
422
423
424
425 </td>
426
427
428 <td class="attributes">
429
430 &lt;optional><br>
431
432
433
434 </td>
435
436
437
438 <td class="default">
439
440 <code>false</code>
441
442 </td>
443
444
445 <td class="description last"><p>Whether the token is greedy.</p></td>
446 </tr>
447
448
449
450 <tr>
451
452 <td class="name"><code>alias</code></td>
453
454
455 <td class="type">
456
457
458 <span class="param-type">string</span>
459 |
460
461 <span class="param-type">Array.&lt;string></span>
462
463
464
465 </td>
466
467
468 <td class="attributes">
469
470 &lt;optional><br>
471
472
473
474 </td>
475
476
477
478 <td class="default">
479
480 </td>
481
482
483 <td class="description last"><p>An optional alias or list of aliases.</p></td>
484 </tr>
485
486
487
488 <tr>
489
490 <td class="name"><code>inside</code></td>
491
492
493 <td class="type">
494
495
496 <span class="param-type"><a href="global.html#Grammar">Grammar</a></span>
497
498
499
500 </td>
501
502
503 <td class="attributes">
504
505 &lt;optional><br>
506
507
508
509 </td>
510
511
512
513 <td class="default">
514
515 </td>
516
517
518 <td class="description last"><p>The nested grammar of this token.</p>
519 <p>The <code>inside</code> grammar will be used to tokenize the text value of each token of this kind.</p>
520 <p>This can be used to make nested and even recursive language definitions.</p>
521 <p>Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
522 each another.</p></td>
523 </tr>
524
525
526 </tbody>
527 </table>
528
529
530
531
532
533
534 <div class="description usertext">
535 <p>The expansion of a simple <code>RegExp</code> literal to support additional properties.</p>
536 </div>
537
538
539
540
541
542
543
544
545
546
547
548
549
550 <h4 class="name" id="HighlightCallback"><span class="type-signature"></span>HighlightCallback<span class="signature">(element)</span><span class="type-signature"> &rarr; {void}</span></h4>
551
552
553
554
555
556
557 <dl class="details">
558
559
560 <dt class="tag-source">Source:</dt>
561 <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#line1247">line 1247</a>
563 </li></ul></dd>
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595 </dl>
596
597
598
599
600
601 <div class="description usertext">
602 <p>A function which will invoked after an element was successfully highlighted.</p>
603 </div>
604
605
606
607
608
609
610
611
612
613
614
615 <h5>Parameters:</h5>
616
617
618 <table class="params">
619 <thead>
620 <tr>
621
622 <th>Name</th>
623
624
625 <th>Type</th>
626
627
628
629
630
631 <th class="last">Description</th>
632 </tr>
633 </thead>
634
635 <tbody>
636
637
638 <tr>
639
640 <td class="name"><code>element</code></td>
641
642
643 <td class="type">
644
645
646 <span class="param-type">Element</span>
647
648
649
650 </td>
651
652
653
654
655
656 <td class="description last"><p>The element successfully highlighted.</p></td>
657 </tr>
658
659
660 </tbody>
661 </table>
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678 <h5>Returns:</h5>
679
680
681
682
683 <dl class="param-type">
684 <dt>
685 Type
686 </dt>
687 <dd>
688
689 <span class="param-type">void</span>
690
691
692 </dd>
693 </dl>
694
695
696
697
698
699
700
701
702
703
704 <h4 class="name" id="HookCallback"><span class="type-signature"></span>HookCallback<span class="signature">(env)</span><span class="type-signature"> &rarr; {void}</span></h4>
705
706
707
708
709
710
711 <dl class="details">
712
713
714 <dt class="tag-source">Source:</dt>
715 <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#line1257">line 1257</a>
717 </li></ul></dd>
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749 </dl>
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765 <h5>Parameters:</h5>
766
767
768 <table class="params">
769 <thead>
770 <tr>
771
772 <th>Name</th>
773
774
775 <th>Type</th>
776
777
778
779
780
781 <th class="last">Description</th>
782 </tr>
783 </thead>
784
785 <tbody>
786
787
788 <tr>
789
790 <td class="name"><code>env</code></td>
791
792
793 <td class="type">
794
795
796 <span class="param-type">Object.&lt;string, any></span>
797
798
799
800 </td>
801
802
803
804
805
806 <td class="description last"><p>The environment variables of the hook.</p></td>
807 </tr>
808
809
810 </tbody>
811 </table>
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828 <h5>Returns:</h5>
829
830
831
832
833 <dl class="param-type">
834 <dt>
835 Type
836 </dt>
837 <dd>
838
839 <span class="param-type">void</span>
840
841
842 </dd>
843 </dl>
844
845
846
847
848
849
850
851 <h4 class="name" id="TokenStream">TokenStream</h4>
852
853
854
855
856
857 <dl class="details">
858
859
860 <dt class="tag-source">Source:</dt>
861 <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#line815">line 815</a>
863 </li></ul></dd>
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895 </dl>
896
897
898
899
900
901 <div class="description usertext">
902 <p>A token stream is an array of strings and <a href="Token.html"><code>Token</code></a> objects.</p>
903 <p>Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
904 them.</p>
905 <ol>
906 <li>
907 <p>No adjacent strings.</p>
908 </li>
909 <li>
910 <p>No empty strings.</p>
911 <p>The only exception here is the token stream that only contains the empty string and nothing else.</p>
912 </li>
913 </ol>
914 </div>
915
916
917
918 <h5>Type:</h5>
919 <ul>
920 <li>
921
922 <span class="param-type">Array.&lt;(string|<a href="Token.html">Token</a>)></span>
923
924
925 </li>
926 </ul>
927
928
929
930
931
932
933
934
935
936
937 </article>
938
939 </section>
940
941
942
943
944
945
946 </div>
947
948 <br class="clear">
949
950 <footer>
951 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
952 </footer>
953
954 <script>prettyPrint();</script>
955 <script src="scripts/polyfill.js"></script>
956 <script src="scripts/linenumber.js"></script>
957
958 <script src="scripts/search.js" defer></script>
959
960
961
962 <link type="text/css" rel="stylesheet" href="styles/overwrites.css">
963
964 </body>
965 </html>