Debian Codegraph @

docs/Prism.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4
5 <meta charset="utf-8">
6 <title>Prism - 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">Prism</h1>
45
46
47
48
49
50
51
52 <section>
53
54 <header>
55
56 <h2>
57 Prism
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 <dt class="tag-source">Source:</dt>
73 <dd class="tag-source"><ul class="dummy"><li>
74 <a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line19">line 19</a>
75 </li></ul></dd>
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95 <dt class="tag-author">Author:</dt>
96 <dd class="tag-author">
97 <ul>
98 <li>Lea Verou &lt;https://lea.verou.me></li>
99 </ul>
100 </dd>
101
102
103
104
105
106 <dt class="tag-license">License:</dt>
107 <dd class="tag-license"><ul class="dummy"><li>MIT <https://opensource.org/licenses/MIT></li></ul></dd>
108
109
110
111
112
113
114
115
116
117 </dl>
118
119
120
121
122
123 <div class="description usertext"><p>Prism: Lightweight, robust, elegant syntax highlighting</p></div>
124
125
126
127
128 </div>
129
130
131
132
133
134
135
136
137
138
139
140
141
142 <h3 class="subsection-title">Namespaces</h3>
143
144 <dl>
145 <dt><a href="Prism.hooks.html">hooks</a></dt>
146 <dd></dd>
147
148 <dt><a href="Prism.languages.html">languages</a></dt>
149 <dd></dd>
150 </dl>
151
152
153
154 <h3 class="subsection-title">Members</h3>
155
156
157
158 <h4 class="name" id=".disableWorkerMessageHandler"><span class="type-signature">(static) </span>disableWorkerMessageHandler<span class="type-signature"> :boolean</span></h4>
159
160
161
162
163
164 <dl class="details">
165
166
167 <dt class="tag-source">Source:</dt>
168 <dd class="tag-source"><ul class="dummy"><li>
169 <a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line73">line 73</a>
170 </li></ul></dd>
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 <dt class="tag-default">Default Value:</dt>
197 <dd class="tag-default"><ul class="dummy">
198 <li>false</li>
199 </ul></dd>
200
201
202
203
204
205
206
207 </dl>
208
209
210
211
212
213 <div class="description usertext">
214 <p>By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
215 <code>addEventListener</code> to communicate with its parent instance. However, if you're using Prism manually in your
216 own worker, you don't want it to do this.</p>
217 <p>By setting this value to <code>true</code>, Prism will not add its own listeners to the worker.</p>
218 <p>You obviously have to change this value before Prism executes. To do this, you can add an
219 empty Prism object into the global scope before loading the Prism script like this:</p>
220 <pre class="prettyprint source lang-js"><code>window.Prism = window.Prism || {};
221 Prism.disableWorkerMessageHandler = true;
222 // Load Prism's script
223 </code></pre>
224 </div>
225
226
227
228 <h5>Type:</h5>
229 <ul>
230 <li>
231
232 <span class="param-type">boolean</span>
233
234
235 </li>
236 </ul>
237
238
239
240
241
242
243
244
245 <h4 class="name" id=".manual"><span class="type-signature">(static) </span>manual<span class="type-signature"> :boolean</span></h4>
246
247
248
249
250
251 <dl class="details">
252
253
254 <dt class="tag-source">Source:</dt>
255 <dd class="tag-source"><ul class="dummy"><li>
256 <a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line51">line 51</a>
257 </li></ul></dd>
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283 <dt class="tag-default">Default Value:</dt>
284 <dd class="tag-default"><ul class="dummy">
285 <li>false</li>
286 </ul></dd>
287
288
289
290
291
292
293
294 </dl>
295
296
297
298
299
300 <div class="description usertext">
301 <p>By default, Prism will attempt to highlight all code elements (by calling <a href="Prism.html#.highlightAll"><code>Prism.highlightAll</code></a>) on the
302 current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
303 additional languages or plugins yourself.</p>
304 <p>By setting this value to <code>true</code>, Prism will not automatically highlight all code elements on the page.</p>
305 <p>You obviously have to change this value before the automatic highlighting started. To do this, you can add an
306 empty Prism object into the global scope before loading the Prism script like this:</p>
307 <pre class="prettyprint source lang-js"><code>window.Prism = window.Prism || {};
308 Prism.manual = true;
309 // add a new &lt;script> to load Prism's script
310 </code></pre>
311 </div>
312
313
314
315 <h5>Type:</h5>
316 <ul>
317 <li>
318
319 <span class="param-type">boolean</span>
320
321
322 </li>
323 </ul>
324
325
326
327
328
329
330
331
332
333
334 <h3 class="subsection-title">Methods</h3>
335
336
337
338
339
340
341 <h4 class="name" id=".highlight"><span class="type-signature">(static) </span>highlight<span class="signature">(text, grammar, language)</span><span class="type-signature"> &rarr; {string}</span></h4>
342
343
344
345
346
347
348 <dl class="details">
349
350
351 <dt class="tag-source">Source:</dt>
352 <dd class="tag-source"><ul class="dummy"><li>
353 <a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line655">line 655</a>
354 </li></ul></dd>
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386 </dl>
387
388
389
390
391
392 <div class="description usertext">
393 <p>Low-level function, only use if you know what you’re doing. It accepts a string of text as input
394 and the language definitions to use, and returns a string with the HTML produced.</p>
395 <p>The following hooks will be run:</p>
396 <ol>
397 <li><code>before-tokenize</code></li>
398 <li><code>after-tokenize</code></li>
399 <li><code>wrap</code>: On each <a href="Token.html"><code>Token</code></a>.</li>
400 </ol>
401 </div>
402
403
404
405
406
407
408
409
410
411 <h5>Example</h5>
412
413 <pre class="prettyprint"><code>Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');</code></pre>
414
415
416
417
418 <h5>Parameters:</h5>
419
420
421 <table class="params">
422 <thead>
423 <tr>
424
425 <th>Name</th>
426
427
428 <th>Type</th>
429
430
431
432
433
434 <th class="last">Description</th>
435 </tr>
436 </thead>
437
438 <tbody>
439
440
441 <tr>
442
443 <td class="name"><code>text</code></td>
444
445
446 <td class="type">
447
448
449 <span class="param-type">string</span>
450
451
452
453 </td>
454
455
456
457
458
459 <td class="description last"><p>A string with the code to be highlighted.</p></td>
460 </tr>
461
462
463
464 <tr>
465
466 <td class="name"><code>grammar</code></td>
467
468
469 <td class="type">
470
471
472 <span class="param-type"><a href="global.html#Grammar">Grammar</a></span>
473
474
475
476 </td>
477
478
479
480
481
482 <td class="description last"><p>An object containing the tokens to use.</p>
483 <p>Usually a language definition like <code>Prism.languages.markup</code>.</p></td>
484 </tr>
485
486
487
488 <tr>
489
490 <td class="name"><code>language</code></td>
491
492
493 <td class="type">
494
495
496 <span class="param-type">string</span>
497
498
499
500 </td>
501
502
503
504
505
506 <td class="description last"><p>The name of the language definition passed to <code>grammar</code>.</p></td>
507 </tr>
508
509
510 </tbody>
511 </table>
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528 <h5>Returns:</h5>
529
530
531 <div class="param-desc">
532 <p>The highlighted HTML.</p>
533 </div>
534
535
536
537 <dl class="param-type">
538 <dt>
539 Type
540 </dt>
541 <dd>
542
543 <span class="param-type">string</span>
544
545
546 </dd>
547 </dl>
548
549
550
551
552
553
554
555
556
557
558 <h4 class="name" id=".highlightAll"><span class="type-signature">(static) </span>highlightAll<span class="signature">(async<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
559
560
561
562
563
564
565 <dl class="details">
566
567
568 <dt class="tag-source">Source:</dt>
569 <dd class="tag-source"><ul class="dummy"><li>
570 <a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line497">line 497</a>
571 </li></ul></dd>
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603 </dl>
604
605
606
607
608
609 <div class="description usertext">
610 <p>This is the most high-level function in Prism’s API.
611 It fetches all the elements that have a <code>.language-xxxx</code> class and then calls <a href="Prism.html#.highlightElement"><code>Prism.highlightElement</code></a> on
612 each one of them.</p>
613 <p>This is equivalent to <code>Prism.highlightAllUnder(document, async, callback)</code>.</p>
614 </div>
615
616
617
618
619
620
621
622
623
624
625
626 <h5>Parameters:</h5>
627
628
629 <table class="params">
630 <thead>
631 <tr>
632
633 <th>Name</th>
634
635
636 <th>Type</th>
637
638
639 <th>Attributes</th>
640
641
642
643 <th>Default</th>
644
645
646 <th class="last">Description</th>
647 </tr>
648 </thead>
649
650 <tbody>
651
652
653 <tr>
654
655 <td class="name"><code>async</code></td>
656
657
658 <td class="type">
659
660
661 <span class="param-type">boolean</span>
662
663
664
665 </td>
666
667
668 <td class="attributes">
669
670 &lt;optional><br>
671
672
673
674
675
676 </td>
677
678
679
680 <td class="default">
681
682 <code>false</code>
683
684 </td>
685
686
687 <td class="description last"><p>Same as in <a href="Prism.html#.highlightAllUnder"><code>Prism.highlightAllUnder</code></a>.</p></td>
688 </tr>
689
690
691
692 <tr>
693
694 <td class="name"><code>callback</code></td>
695
696
697 <td class="type">
698
699
700 <span class="param-type"><a href="global.html#HighlightCallback">HighlightCallback</a></span>
701
702
703
704 </td>
705
706
707 <td class="attributes">
708
709 &lt;optional><br>
710
711
712
713
714
715 </td>
716
717
718
719 <td class="default">
720
721 </td>
722
723
724 <td class="description last"><p>Same as in <a href="Prism.html#.highlightAllUnder"><code>Prism.highlightAllUnder</code></a>.</p></td>
725 </tr>
726
727
728 </tbody>
729 </table>
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754 <h4 class="name" id=".highlightAllUnder"><span class="type-signature">(static) </span>highlightAllUnder<span class="signature">(container, async<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
755
756
757
758
759
760
761 <dl class="details">
762
763
764 <dt class="tag-source">Source:</dt>
765 <dd class="tag-source"><ul class="dummy"><li>
766 <a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line516">line 516</a>
767 </li></ul></dd>
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799 </dl>
800
801
802
803
804
805 <div class="description usertext">
806 <p>Fetches all the descendants of <code>container</code> that have a <code>.language-xxxx</code> class and then calls
807 <a href="Prism.html#.highlightElement"><code>Prism.highlightElement</code></a> on each one of them.</p>
808 <p>The following hooks will be run:</p>
809 <ol>
810 <li><code>before-highlightall</code></li>
811 <li><code>before-all-elements-highlight</code></li>
812 <li>All hooks of <a href="Prism.html#.highlightElement"><code>Prism.highlightElement</code></a> for each element.</li>
813 </ol>
814 </div>
815
816
817
818
819
820
821
822
823
824
825
826 <h5>Parameters:</h5>
827
828
829 <table class="params">
830 <thead>
831 <tr>
832
833 <th>Name</th>
834
835
836 <th>Type</th>
837
838
839 <th>Attributes</th>
840
841
842
843 <th>Default</th>
844
845
846 <th class="last">Description</th>
847 </tr>
848 </thead>
849
850 <tbody>
851
852
853 <tr>
854
855 <td class="name"><code>container</code></td>
856
857
858 <td class="type">
859
860
861 <span class="param-type">ParentNode</span>
862
863
864
865 </td>
866
867
868 <td class="attributes">
869
870
871
872
873
874 </td>
875
876
877
878 <td class="default">
879
880 </td>
881
882
883 <td class="description last"><p>The root element, whose descendants that have a <code>.language-xxxx</code> class will be highlighted.</p></td>
884 </tr>
885
886
887
888 <tr>
889
890 <td class="name"><code>async</code></td>
891
892
893 <td class="type">
894
895
896 <span class="param-type">boolean</span>
897
898
899
900 </td>
901
902
903 <td class="attributes">
904
905 &lt;optional><br>
906
907
908
909
910
911 </td>
912
913
914
915 <td class="default">
916
917 <code>false</code>
918
919 </td>
920
921
922 <td class="description last"><p>Whether each element is to be highlighted asynchronously using Web Workers.</p></td>
923 </tr>
924
925
926
927 <tr>
928
929 <td class="name"><code>callback</code></td>
930
931
932 <td class="type">
933
934
935 <span class="param-type"><a href="global.html#HighlightCallback">HighlightCallback</a></span>
936
937
938
939 </td>
940
941
942 <td class="attributes">
943
944 &lt;optional><br>
945
946
947
948
949
950 </td>
951
952
953
954 <td class="default">
955
956 </td>
957
958
959 <td class="description last"><p>An optional callback to be invoked on each element after its highlighting is done.</p></td>
960 </tr>
961
962
963 </tbody>
964 </table>
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989 <h4 class="name" id=".highlightElement"><span class="type-signature">(static) </span>highlightElement<span class="signature">(element, async<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
990
991
992
993
994
995
996 <dl class="details">
997
998
999 <dt class="tag-source">Source:</dt>
1000 <dd class="tag-source"><ul class="dummy"><li>
1001 <a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line562">line 562</a>
1002 </li></ul></dd>
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034 </dl>
1035
1036
1037
1038
1039
1040 <div class="description usertext">
1041 <p>Highlights the code inside a single element.</p>
1042 <p>The following hooks will be run:</p>
1043 <ol>
1044 <li><code>before-sanity-check</code></li>
1045 <li><code>before-highlight</code></li>
1046 <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>
1047 <li><code>before-insert</code></li>
1048 <li><code>after-highlight</code></li>
1049 <li><code>complete</code></li>
1050 </ol>
1051 <p>Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
1052 the element's language.</p>
1053 </div>
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065 <h5>Parameters:</h5>
1066
1067
1068 <table class="params">
1069 <thead>
1070 <tr>
1071
1072 <th>Name</th>
1073
1074
1075 <th>Type</th>
1076
1077
1078 <th>Attributes</th>
1079
1080
1081
1082 <th>Default</th>
1083
1084
1085 <th class="last">Description</th>
1086 </tr>
1087 </thead>
1088
1089 <tbody>
1090
1091
1092 <tr>
1093
1094 <td class="name"><code>element</code></td>
1095
1096
1097 <td class="type">
1098
1099
1100 <span class="param-type">Element</span>
1101
1102
1103
1104 </td>
1105
1106
1107 <td class="attributes">
1108
1109
1110
1111
1112
1113 </td>
1114
1115
1116
1117 <td class="default">
1118
1119 </td>
1120
1121
1122 <td class="description last"><p>The element containing the code.
1123 It must have a class of <code>language-xxxx</code> to be processed, where <code>xxxx</code> is a valid language identifier.</p></td>
1124 </tr>
1125
1126
1127
1128 <tr>
1129
1130 <td class="name"><code>async</code></td>
1131
1132
1133 <td class="type">
1134
1135
1136 <span class="param-type">boolean</span>
1137
1138
1139
1140 </td>
1141
1142
1143 <td class="attributes">
1144
1145 &lt;optional><br>
1146
1147
1148
1149
1150
1151 </td>
1152
1153
1154
1155 <td class="default">
1156
1157 <code>false</code>
1158
1159 </td>
1160
1161
1162 <td class="description last"><p>Whether the element is to be highlighted asynchronously using Web Workers
1163 to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
1164 <a href="https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default">disabled by default</a>.</p>
1165 <p>Note: All language definitions required to highlight the code must be included in the main <code>prism.js</code> file for
1166 asynchronous highlighting to work. You can build your own bundle on the
1167 <a href="https://prismjs.com/download.html">Download page</a>.</p></td>
1168 </tr>
1169
1170
1171
1172 <tr>
1173
1174 <td class="name"><code>callback</code></td>
1175
1176
1177 <td class="type">
1178
1179
1180 <span class="param-type"><a href="global.html#HighlightCallback">HighlightCallback</a></span>
1181
1182
1183
1184 </td>
1185
1186
1187 <td class="attributes">
1188
1189 &lt;optional><br>
1190
1191
1192
1193
1194
1195 </td>
1196
1197
1198
1199 <td class="default">
1200
1201 </td>
1202
1203
1204 <td class="description last"><p>An optional callback to be invoked after the highlighting is done.
1205 Mostly useful when <code>async</code> is <code>true</code>, since in that case, the highlighting is done asynchronously.</p></td>
1206 </tr>
1207
1208
1209 </tbody>
1210 </table>
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235 <h4 class="name" id=".tokenize"><span class="type-signature">(static) </span>tokenize<span class="signature">(text, grammar)</span><span class="type-signature"> &rarr; {<a href="global.html#TokenStream">TokenStream</a>}</span></h4>
1236
1237
1238
1239
1240
1241
1242 <dl class="details">
1243
1244
1245 <dt class="tag-source">Source:</dt>
1246 <dd class="tag-source"><ul class="dummy"><li>
1247 <a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line694">line 694</a>
1248 </li></ul></dd>
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280 </dl>
1281
1282
1283
1284
1285
1286 <div class="description usertext">
1287 <p>This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
1288 and the language definitions to use, and returns an array with the tokenized code.</p>
1289 <p>When the language definition includes nested tokens, the function is called recursively on each of these tokens.</p>
1290 <p>This method could be useful in other contexts as well, as a very crude parser.</p>
1291 </div>
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301 <h5>Example</h5>
1302
1303 <pre class="prettyprint"><code>let code = `var foo = 0;`;
1304 let tokens = Prism.tokenize(code, Prism.languages.javascript);
1305 tokens.forEach(token => {
1306 if (token instanceof Prism.Token &amp;&amp; token.type === 'number') {
1307 console.log(`Found numeric literal: ${token.content}`);
1308 }
1309 });</code></pre>
1310
1311
1312
1313
1314 <h5>Parameters:</h5>
1315
1316
1317 <table class="params">
1318 <thead>
1319 <tr>
1320
1321 <th>Name</th>
1322
1323
1324 <th>Type</th>
1325
1326
1327
1328
1329
1330 <th class="last">Description</th>
1331 </tr>
1332 </thead>
1333
1334 <tbody>
1335
1336
1337 <tr>
1338
1339 <td class="name"><code>text</code></td>
1340
1341
1342 <td class="type">
1343
1344
1345 <span class="param-type">string</span>
1346
1347
1348
1349 </td>
1350
1351
1352
1353
1354
1355 <td class="description last"><p>A string with the code to be highlighted.</p></td>
1356 </tr>
1357
1358
1359
1360 <tr>
1361
1362 <td class="name"><code>grammar</code></td>
1363
1364
1365 <td class="type">
1366
1367
1368 <span class="param-type"><a href="global.html#Grammar">Grammar</a></span>
1369
1370
1371
1372 </td>
1373
1374
1375
1376
1377
1378 <td class="description last"><p>An object containing the tokens to use.</p>
1379 <p>Usually a language definition like <code>Prism.languages.markup</code>.</p></td>
1380 </tr>
1381
1382
1383 </tbody>
1384 </table>
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401 <h5>Returns:</h5>
1402
1403
1404 <div class="param-desc">
1405 <p>An array of strings and tokens, a token stream.</p>
1406 </div>
1407
1408
1409
1410 <dl class="param-type">
1411 <dt>
1412 Type
1413 </dt>
1414 <dd>
1415
1416 <span class="param-type"><a href="global.html#TokenStream">TokenStream</a></span>
1417
1418
1419 </dd>
1420 </dl>
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432 </article>
1433
1434 </section>
1435
1436
1437
1438
1439
1440
1441 </div>
1442
1443 <br class="clear">
1444
1445 <footer>
1446 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.
1447 </footer>
1448
1449 <script>prettyPrint();</script>
1450 <script src="scripts/polyfill.js"></script>
1451 <script src="scripts/linenumber.js"></script>
1452
1453 <script src="scripts/search.js" defer></script>
1454
1455
1456
1457 <link type="text/css" rel="stylesheet" href="styles/overwrites.css">
1458
1459 </body>
1460 </html>