@speed-highlight/core 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/.gitattributes +2 -0
  2. package/CODE_OF_CONDUCT.md +128 -0
  3. package/CONTRIBUTING.md +34 -0
  4. package/LICENSE +121 -0
  5. package/README.md +140 -0
  6. package/assets/screenshot.png +0 -0
  7. package/dist/common.js +1 -0
  8. package/dist/detect.js +1 -0
  9. package/dist/index.js +3 -0
  10. package/dist/languages/asm.js +1 -0
  11. package/dist/languages/bash.js +1 -0
  12. package/dist/languages/bf.js +1 -0
  13. package/dist/languages/c.js +1 -0
  14. package/dist/languages/css.js +1 -0
  15. package/dist/languages/csv.js +1 -0
  16. package/dist/languages/diff.js +1 -0
  17. package/dist/languages/docker.js +1 -0
  18. package/dist/languages/git.js +1 -0
  19. package/dist/languages/go.js +1 -0
  20. package/dist/languages/html.js +1 -0
  21. package/dist/languages/http.js +1 -0
  22. package/dist/languages/ini.js +1 -0
  23. package/dist/languages/java.js +1 -0
  24. package/dist/languages/js.js +1 -0
  25. package/dist/languages/js_template_literals.js +1 -0
  26. package/dist/languages/jsdoc.js +1 -0
  27. package/dist/languages/json.js +1 -0
  28. package/dist/languages/leanpub-md.js +2 -0
  29. package/dist/languages/log.js +1 -0
  30. package/dist/languages/lua.js +1 -0
  31. package/dist/languages/make.js +1 -0
  32. package/dist/languages/md.js +2 -0
  33. package/dist/languages/pl.js +1 -0
  34. package/dist/languages/plain.js +1 -0
  35. package/dist/languages/py.js +1 -0
  36. package/dist/languages/regex.js +1 -0
  37. package/dist/languages/rs.js +1 -0
  38. package/dist/languages/sql.js +1 -0
  39. package/dist/languages/todo.js +1 -0
  40. package/dist/languages/toml.js +1 -0
  41. package/dist/languages/ts.js +1 -0
  42. package/dist/languages/uri.js +1 -0
  43. package/dist/languages/xml.js +1 -0
  44. package/dist/languages/yaml.js +1 -0
  45. package/dist/node/common.js +1 -0
  46. package/dist/node/detect.js +1 -0
  47. package/dist/node/index.js +3 -0
  48. package/dist/node/languages/asm.js +1 -0
  49. package/dist/node/languages/bash.js +1 -0
  50. package/dist/node/languages/bf.js +1 -0
  51. package/dist/node/languages/c.js +1 -0
  52. package/dist/node/languages/css.js +1 -0
  53. package/dist/node/languages/csv.js +1 -0
  54. package/dist/node/languages/diff.js +1 -0
  55. package/dist/node/languages/docker.js +1 -0
  56. package/dist/node/languages/git.js +1 -0
  57. package/dist/node/languages/go.js +1 -0
  58. package/dist/node/languages/html.js +1 -0
  59. package/dist/node/languages/http.js +1 -0
  60. package/dist/node/languages/ini.js +1 -0
  61. package/dist/node/languages/java.js +1 -0
  62. package/dist/node/languages/js.js +1 -0
  63. package/dist/node/languages/js_template_literals.js +1 -0
  64. package/dist/node/languages/jsdoc.js +1 -0
  65. package/dist/node/languages/json.js +1 -0
  66. package/dist/node/languages/leanpub-md.js +2 -0
  67. package/dist/node/languages/log.js +1 -0
  68. package/dist/node/languages/lua.js +1 -0
  69. package/dist/node/languages/make.js +1 -0
  70. package/dist/node/languages/md.js +2 -0
  71. package/dist/node/languages/pl.js +1 -0
  72. package/dist/node/languages/plain.js +1 -0
  73. package/dist/node/languages/py.js +1 -0
  74. package/dist/node/languages/regex.js +1 -0
  75. package/dist/node/languages/rs.js +1 -0
  76. package/dist/node/languages/sql.js +1 -0
  77. package/dist/node/languages/todo.js +1 -0
  78. package/dist/node/languages/toml.js +1 -0
  79. package/dist/node/languages/ts.js +1 -0
  80. package/dist/node/languages/uri.js +1 -0
  81. package/dist/node/languages/xml.js +1 -0
  82. package/dist/node/languages/yaml.js +1 -0
  83. package/dist/node/term.js +1 -0
  84. package/dist/node/themes/default.js +1 -0
  85. package/dist/term.js +1 -0
  86. package/dist/themes/atom-dark.css +1 -0
  87. package/dist/themes/dark.css +1 -0
  88. package/dist/themes/default.css +1 -0
  89. package/dist/themes/default.js +1 -0
  90. package/dist/themes/github-dark.css +1 -0
  91. package/dist/themes/github-dim.css +1 -0
  92. package/dist/themes/github-light.css +1 -0
  93. package/dist/themes/visual-studio-dark.css +1 -0
  94. package/examples/deno.js +14 -0
  95. package/examples/dist.html +27 -0
  96. package/examples/helper/data.js +51 -0
  97. package/examples/helper/elm.js +58 -0
  98. package/examples/index.html +52 -0
  99. package/examples/languages/oneline.bash +1 -0
  100. package/examples/languages/oneline.http +1 -0
  101. package/examples/languages/screenshot.js +18 -0
  102. package/examples/languages/test.asm +17 -0
  103. package/examples/languages/test.bash +32 -0
  104. package/examples/languages/test.bf +21 -0
  105. package/examples/languages/test.c +57 -0
  106. package/examples/languages/test.css +20 -0
  107. package/examples/languages/test.csv +4 -0
  108. package/examples/languages/test.diff +27 -0
  109. package/examples/languages/test.docker +23 -0
  110. package/examples/languages/test.git +10 -0
  111. package/examples/languages/test.go +21 -0
  112. package/examples/languages/test.html +27 -0
  113. package/examples/languages/test.http +17 -0
  114. package/examples/languages/test.ini +6 -0
  115. package/examples/languages/test.java +52 -0
  116. package/examples/languages/test.js +34 -0
  117. package/examples/languages/test.jsdoc +2 -0
  118. package/examples/languages/test.json +24 -0
  119. package/examples/languages/test.leanpub-md +21 -0
  120. package/examples/languages/test.log +32 -0
  121. package/examples/languages/test.lua +62 -0
  122. package/examples/languages/test.make +51 -0
  123. package/examples/languages/test.md +62 -0
  124. package/examples/languages/test.pl +25 -0
  125. package/examples/languages/test.plain +3 -0
  126. package/examples/languages/test.py +38 -0
  127. package/examples/languages/test.regex +2 -0
  128. package/examples/languages/test.rs +38 -0
  129. package/examples/languages/test.sql +6 -0
  130. package/examples/languages/test.todo +18 -0
  131. package/examples/languages/test.toml +16 -0
  132. package/examples/languages/test.ts +43 -0
  133. package/examples/languages/test.uri +9 -0
  134. package/examples/languages/test.xml +44 -0
  135. package/examples/languages/test.yaml +18 -0
  136. package/examples/node.js +11 -0
  137. package/examples/style.css +28 -0
  138. package/examples/worker.html +19 -0
  139. package/examples/worker.js +6 -0
  140. package/package.json +40 -0
  141. package/src/common.js +18 -0
  142. package/src/detect.js +33 -0
  143. package/src/index.js +129 -0
  144. package/src/languages/asm.js +30 -0
  145. package/src/languages/bash.js +44 -0
  146. package/src/languages/bf.js +18 -0
  147. package/src/languages/c.js +52 -0
  148. package/src/languages/css.js +56 -0
  149. package/src/languages/csv.js +9 -0
  150. package/src/languages/diff.js +18 -0
  151. package/src/languages/docker.js +9 -0
  152. package/src/languages/git.js +20 -0
  153. package/src/languages/go.js +28 -0
  154. package/src/languages/html.js +51 -0
  155. package/src/languages/http.js +30 -0
  156. package/src/languages/ini.js +22 -0
  157. package/src/languages/java.js +28 -0
  158. package/src/languages/js.js +48 -0
  159. package/src/languages/js_template_literals.js +34 -0
  160. package/src/languages/jsdoc.js +18 -0
  161. package/src/languages/json.js +20 -0
  162. package/src/languages/leanpub-md.js +34 -0
  163. package/src/languages/log.js +28 -0
  164. package/src/languages/lua.js +28 -0
  165. package/src/languages/make.js +36 -0
  166. package/src/languages/md.js +48 -0
  167. package/src/languages/pl.js +25 -0
  168. package/src/languages/plain.js +5 -0
  169. package/src/languages/py.js +52 -0
  170. package/src/languages/regex.js +19 -0
  171. package/src/languages/rs.js +28 -0
  172. package/src/languages/sql.js +33 -0
  173. package/src/languages/todo.js +19 -0
  174. package/src/languages/toml.js +36 -0
  175. package/src/languages/ts.js +13 -0
  176. package/src/languages/uri.js +26 -0
  177. package/src/languages/xml.js +68 -0
  178. package/src/languages/yaml.js +32 -0
  179. package/src/term.js +19 -0
  180. package/src/themes/atom-dark.css +23 -0
  181. package/src/themes/dark.css +23 -0
  182. package/src/themes/default.css +87 -0
  183. package/src/themes/default.js +26 -0
  184. package/src/themes/github-dark.css +23 -0
  185. package/src/themes/github-dim.css +3 -0
  186. package/src/themes/github-light.css +21 -0
  187. package/src/themes/visual-studio-dark.css +23 -0
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ matubu@github.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
@@ -0,0 +1,34 @@
1
+ # Welcome :wave:
2
+
3
+ If you are considering contributing to Speed Highlight JS this document is for you
4
+
5
+ Contributions are greatly appreciated
6
+
7
+ There are many ways to contribute (you do not have to be a programmer):
8
+
9
+ * Report [issues or bugs](https://github.com/matubu/speed_highlight_js/issues) :bug:, join the existing discussion on open issues
10
+ * Submit [pull requests](https://github.com/matubu/speed_highlight_js/pulls)
11
+ * Write plugins
12
+ * Create [language definitions](https://github.com/matubu/speed_highlight_js/wiki/Create-suggest-new-languages) :globe_with_meridians:
13
+ * Design [themes](https://github.com/matubu/speed_highlight_js/wiki/Create-new-themes-styles) :rainbow:
14
+ * Improve our [documentation](https://github.com/matubu/speed_highlight_js/wiki) :bookmark_tabs:
15
+
16
+ # Prerequisites :books:
17
+
18
+ * To help answer questions on issues or contribute you only need to be friendly
19
+ * To contribute to language definitions knowing Regular Expressions is really helpful
20
+ * To work on the core you'll need to know a bit JavaScript
21
+ * To work on documentation you'll need motivation
22
+ * :bulb: Knowing well the language that you highlight can help you out a lot
23
+
24
+ # Requesting Features :page_with_curl:
25
+
26
+ Feature requests are always welcome
27
+
28
+ If you wish we supported a language we don't, you can read [this](https://github.com/matubu/speed_highlight_js/wiki/Create-suggest-new-languages)
29
+
30
+ If you find a bug or think of an improvement, feel free to open an issue
31
+
32
+ # Fixing Issues (PRs) :construction_worker_man:
33
+
34
+ If you feel comfortable with the prerequisites, you can grab any issue preferably marked as "good first issue"
package/LICENSE ADDED
@@ -0,0 +1,121 @@
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
package/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # Speed Highlight JS
2
+
3
+ Light, fast, and easy to use, dependencies free javascript syntax highlighter, with automatic language detection, [try it out here](https://speed-highlight.github.io/core/examples/)
4
+
5
+ ![](https://raw.githubusercontent.com/speed-highlight/core/main/assets/screenshot.png)
6
+
7
+ ## Light 📦
8
+
9
+ * The core is about **1kB** (gzipped & minified)
10
+ * Languages definition are from **a few bytes** to **1kB**
11
+ * Themes are about **1kB**
12
+ * Language rules needed are automatically loaded
13
+
14
+ ## Fast ⚡
15
+
16
+ Blazing fast highlighting using regex
17
+
18
+ ## Simple setup 🚀
19
+
20
+ ### Web
21
+
22
+ Style/theme (in the header of your html file):
23
+ ```html
24
+ <link rel="stylesheet" href="/path/dist/themes/default.css">
25
+ ```
26
+
27
+ In the body of your html file:
28
+ ```html
29
+ <div class='shj-lang-[code-language]'>[code]</div>
30
+ or
31
+ <code class='shj-lang-[code-language]'>[inline code]</code>
32
+ ```
33
+
34
+ Highlight the code (in your javascript):
35
+ ```js
36
+ import { highlightAll } from '/path/dist/index.js'
37
+ highlightAll();
38
+ ```
39
+
40
+ Auto language detection
41
+ ```js
42
+ import { highlightElement } from '../src/index.js';
43
+ import { detectLanguage } from '../src/detect.js';
44
+
45
+ elm.textContent = code;
46
+ highlightElement(elm, detectLanguage(code));
47
+ ```
48
+
49
+ #### CDN
50
+
51
+ ```js
52
+ import ... from 'https://unpkg.com/speed_highlight_js/dist/index.js'
53
+ import ... from 'https://cdn.jsdelivr.net/gh/matubu/speed_highlight_js/dist/index.js'
54
+ ```
55
+
56
+ ### Deno
57
+
58
+ Use the [deno module](https://deno.land/x/speed_highlight_js)
59
+
60
+ ```js
61
+ import { setTheme, printHighlight } from 'https://x.nest.land/speed_highlight_js/dist/term.js';
62
+
63
+ await setTheme('default');
64
+ printHighlight('console.log("hello")', 'js');
65
+ ```
66
+
67
+ ## Node
68
+
69
+ Use the [npm package](https://www.npmjs.com/package/speed_highlight_js)
70
+
71
+ ```bash
72
+ npm install speed_highlight_js
73
+ ```
74
+
75
+ ```js
76
+ const { setTheme, printHighlight } = require('speed_highlight_js/dist/node/term.js');
77
+
78
+ setTheme('default')
79
+ printHighlight('console.log("hello")', 'js');
80
+ ```
81
+
82
+ ## Languages supported 🌐
83
+
84
+ | Name | Class name | Support | Language detection |
85
+ | ---------- | ------------------- | --------------------------------------------------- | ------------------ |
86
+ | bash | shj-lang-bash | | ✅ |
87
+ | brainfuck | shj-lang-bf | increment, operator, print, comment | ❌ |
88
+ | css | shj-lang-css | comment, str, selector, units, function, ... | ✅ |
89
+ | csv | shj-lang-csv | punctuation, ... | ❌ |
90
+ | diff | shj-lang-diff | | ✅ |
91
+ | git | shj-lang-git | comment, insert, deleted, string, ... | ❌ |
92
+ | html | shj-lang-html | | ✅ |
93
+ | http | shj-lang-http | keywork, string, punctuation, variable, version | ✅ |
94
+ | ini | shj-lang-ini | | ❌ |
95
+ | javascipt | shj-lang-js | basic syntax, regex, jsdoc, json, template literals | ✅ |
96
+ | jsdoc | shj-lang-jsdoc | | ❌ |
97
+ | json | shj-lang-json | string, number, bool, ... | ❌ |
98
+ | leanpub-md | shj-lang-leanpub-md | | ❌ |
99
+ | log | shj-lang-log | number, string, comment, errors | ❌ |
100
+ | lua | shj-lang-lua | | ✅ |
101
+ | makefile | shj-lang-make | | ✅ |
102
+ | markdown | shj-lang-md | | ✅ |
103
+ | perl | shj-lang-pl | | ✅ |
104
+ | plain | shj-lang-plain | | ❌ |
105
+ | python | shj-lang-py | | ✅ |
106
+ | regex | shj-lang-regex | count, set, ... | ❌ |
107
+ | sql | shj-lang-sql | number, string, function, ... | ✅ |
108
+ | todo | shj-lang-todo | | ❌ |
109
+ | toml | shj-lang-toml | comment, table, string, bool, variable | ❌ |
110
+ | typescript | shj-lang-ts | js syntax, ts keyword, types | ✅ |
111
+ | uri | shj-lang-uri | | ✅ |
112
+ | yaml | shj-lang-yaml | comment, numbers, variable, string, bool | ❌ |
113
+ | docker | shj-lang-docker | | ✅ |
114
+ | c | shj-lang-c | | ✅ |
115
+ | xml | shj-lang-xml | | ✅ |
116
+ | rust | shj-lang-rs | | ✅ |
117
+ | go | shj-lang-go | | ✅ |
118
+ | java | shj-lang-java | | ✅ |
119
+ | asm | shj-lang-asm | | ✅ |
120
+
121
+ ## Themes 🌈
122
+
123
+ A modern theme by default
124
+
125
+ | Name | Terminal | Web |
126
+ | ------------------- | -------- | --- |
127
+ | default | ✅ | ✅ |
128
+ | github-dark | ❌ | ✅ |
129
+ | github-light | ❌ | ✅ |
130
+ | github-dim | ❌ | ✅ |
131
+ | atom-dark | ❌ | ✅ |
132
+ | visual-studio-dark | ❌ | ✅ |
133
+
134
+ ## Wiki 👀
135
+
136
+ Further in-depth documentation for the API and other topics is in our [Wiki](https://github.com/speed-highlight/core/wiki)
137
+
138
+ ## License 📃
139
+
140
+ Shj is released under the Creative Commons Zero License. See our [LICENSE](https://github.com/speed-highlight/core/blob/main/LICENSE) file for details.
Binary file
package/dist/common.js ADDED
@@ -0,0 +1 @@
1
+ var t={num:{type:"num",match:/(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g},str:{type:"str",match:/(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g},strDouble:{type:"str",match:/"((?!")[^\r\n\\]|\\[^])*"?/g}};export{t as default};
package/dist/detect.js ADDED
@@ -0,0 +1 @@
1
+ var m=[["bash",[/#!(\/usr)?\/bin\/bash/g,500],[/\b(if|elif|then|fi|echo)\b|\$/g,10]],["html",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^\s+<!DOCTYPE\s+html/g,500]],["http",[/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g,500]],["js",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g,10]],["ts",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g,10]],["py",[/\b(def|print|class|and|or|lambda)\b/g,10]],["sql",[/\b(SELECT|INSERT|FROM)\b/g,50]],["pl",[/#!(\/usr)?\/bin\/perl/g,500],[/\b(use|print)\b|\$/g,10]],["lua",[/#!(\/usr)?\/bin\/lua/g,500]],["make",[/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm,10]],["uri",[/https?:|mailto:|tel:|ftp:/g,30]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["diff",[/^[+><-]/gm,10],[/^@@ ?[-+,0-9 ]+ ?@@/gm,25]],["md",[/^(>|\t\*|\t\d+.)/gm,10],[/\[.*\](.*)/g,10]],["docker",[/^(FROM|ENTRYPOINT|RUN)/gm,500]],["xml",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^<\?xml/g,500]],["c",[/#include\b|\bprintf\s+\(/g,100]],["rs",[/^\s+(use|fn|mut|match)\b/gm,100]],["go",[/\b(func|fmt|package)\b/g,100]],["java",[/^import\s+java/gm,500]],["asm",[/^(section|global main|extern|\t(call|mov|ret))/gm,100]]],l=n=>{var a;return((a=m.map(([t,...e])=>[e.reduce((s,[i,g])=>s+[...n.matchAll(i)].length*g,0),t]).filter(([t,e])=>t>10).sort((t,e)=>e[0]-t[0])[0])==null?void 0:a[1])||"plain"};export{l as detectLanguage};
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ var x={num:{type:"num",match:/(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g},str:{type:"str",match:/(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g},strDouble:{type:"str",match:/"((?!")[^\r\n\\]|\\[^])*"?/g}};var u={},o=(t="")=>{var a,i,s,e;return(e=(i=(a=t.replaceAll("&","&#38;")).replaceAll)==null?void 0:(s=i.call(a,"<","&lt;")).replaceAll)==null?void 0:e.call(s,">","&gt;")},m=(t,a)=>a?`<span class="shj-syn-${a}">${t}</span>`:t;async function f(t,a,i){var s;try{let e,l,n={},p,h=[],c=0,d=typeof a=="string"?await((s=u[a])!=null?s:u[a]=import(`./languages/${a}.js`)):a,r=[...typeof a=="string"?d.default:a.sub];for(;c<t.length;){for(n.index=null,e=r.length;e-- >0;){if(l=r[e].expand?x[r[e].expand]:r[e],h[e]===void 0||h[e].match.index<c){if(l.match.lastIndex=c,p=l.match.exec(t),p===null){r.splice(e,1),h.splice(e,1);continue}h[e]={match:p,lastIndex:l.match.lastIndex}}h[e].match[0]&&(h[e].match.index<=n.index||n.index===null)&&(n={part:l,index:h[e].match.index,match:h[e].match[0],end:h[e].lastIndex})}if(n.index===null)break;i(t.slice(c,n.index),d.type),c=n.end,n.part.sub?await f(n.match,typeof n.part.sub=="string"?n.part.sub:typeof n.part.sub=="function"?n.part.sub(n.match):n.part,i):i(n.match,n.part.type)}i(t.slice(c,t.length),d.type)}catch{i(t)}}async function y(t,a,i=!0){let s=i?`<div><div class="shj-numbers">${"<div></div>".repeat(t.split(`
2
+ `).length)}</div><div>`:"";return await f(t,a,(e,l)=>s+=m(o(e),l)),i&&(s+="</div></div>"),s}async function g(t,a=(s=>(s=t.className.match(/shj-lang-([\w-]+)/))==null?void 0:s[1])(),i){let e=t.textContent;i!=null||(i=`${t.tagName=="CODE"?"in":e.split(`
3
+ `).length<2?"one":"multi"}line`),t.dataset.lang=a,t.className=`${[...t.classList].filter(l=>!l.startsWith("shj-")||l.startsWith("shj-mode-")).join(" ")} shj-lang-${a} shj-${i}`,t.innerHTML=await y(e,a,i=="multiline")}var v=async()=>document.querySelectorAll('[class*="shj-lang-"]').forEach(t=>g(t));export{v as highlightAll,g as highlightElement,y as highlightText,f as tokenize};
@@ -0,0 +1 @@
1
+ var t=[{type:"cmnt",match:/;.*/gm},{expand:"str"},{expand:"num"},{type:"kwd",match:/^[a-z]+\s+[a-z.]+/gm,sub:[{type:"func",match:/^[a-z]+/g}]},{type:"kwd",match:/^\t*[a-z]+/gm},{match:/%|\$/g,type:"oper"}];export{t as default};
@@ -0,0 +1 @@
1
+ var e={type:"var",match:/\$\w+|\${[^}]*}|\$\([^)]*\)/g},t=[{sub:"todo",match:/#.*/g},{type:"str",match:/(["'])((?!\1)[^\r\n\\]|\\[^])*\1?/g,sub:[e]},{type:"kwd",match:/-[a-zA-Z]+|$<|[&|;]+|\b(unset|readonly|shift|export|if|fi|else|elif|while|do|done|for|until|case|esac|break|continue|exit|return|trap|wait|eval|exec|then|declare|enable|local|select|typeset|time|add|remove|install|update|delete)\b/g},{expand:"num"},{type:"func",match:/\b(set|alias|bg|bind|builtin|caller|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|read|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|unset)\b/g},{type:"bool",match:/\b(true|false)\b/g},{type:"func",match:/[a-z_]+(?=\s*\()/g},{type:"oper",match:/[=(){}<>+*/!?~^-]+/g},{type:"var",match:/\w+(?=\s*=)/g},e];export{t as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/[^\[\->+.<\]\s].*/g,sub:"todo"},{type:"func",match:/\.+/g},{type:"kwd",match:/[<>]+/g},{type:"oper",match:/[+-]+/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{expand:"num"},{type:"kwd",match:/#\s*include (<.*>|".*")/g,sub:[{type:"str",match:/(<|").*/g}]},{match:/asm\s*{[^}]*}/g,sub:[{type:"kwd",match:/^asm/g},{match:/[^{}]*(?=}$)/g,sub:"asm"}]},{type:"kwd",match:/\*|&|#[a-z]+\b|\b(asm|auto|double|int|struct|break|else|long|switch|case|enum|register|typedef|char|extern|return|union|const|float|short|unsigned|continue|for|signed|void|default|goto|sizeof|volatile|do|if|static|while)\b/g},{type:"oper",match:/[/*+:?&|%^~=!,<>.^-]+/g},{type:"func",match:/[a-zA-Z_][\w_]*(?=\s*\()/g},{type:"class",match:/[A-Z][\w_]*/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{type:"kwd",match:/@\w+\b|\b(and|not|only|or)\b|\b[a-z-]+(?=[^{}]*{)/g},{type:"var",match:/\b[\w-]+(?=\s*:)|(::?|\.)[\w-]+(?=[^{}]*{)/g},{type:"func",match:/#[\w-]+(?=[^{}]*{)/g},{type:"num",match:/#[\da-f]{3,8}/g},{type:"num",match:/\d+(\.\d+)?(cm|mm|in|px|pt|pc|em|ex|ch|rem|vm|vh|vmin|vmax|%)?/g,sub:[{type:"var",match:/[a-z]+|%/g}]},{match:/url\([^)]*\)/g,sub:[{type:"func",match:/url(?=\()/g},{type:"str",match:/[^()]+/g}]},{type:"func",match:/\b[a-zA-Z]\w*(?=\s*\()/g},{type:"num",match:/\b[a-z-]+\b/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var e=[{expand:"strDouble"},{type:"oper",match:/,/g}];export{e as default};
@@ -0,0 +1 @@
1
+ var t=[{type:"deleted",match:/^[-<].*/gm},{type:"insert",match:/^[+>].*/gm},{type:"kwd",match:/!.*/gm},{type:"section",match:/^@@.*@@$|^\d.*|^([*-+])\1\1.*/gm}];export{t as default};
@@ -0,0 +1 @@
1
+ var e={type:"var",match:/\$\w+|\${[^}]*}|\$\([^)]*\)/g},t=[{sub:"todo",match:/#.*/g},{type:"str",match:/(["'])((?!\1)[^\r\n\\]|\\[^])*\1?/g,sub:[e]},{type:"kwd",match:/-[a-zA-Z]+|$<|[&|;]+|\b(unset|readonly|shift|export|if|fi|else|elif|while|do|done|for|until|case|esac|break|continue|exit|return|trap|wait|eval|exec|then|declare|enable|local|select|typeset|time|add|remove|install|update|delete)\b/g},{expand:"num"},{type:"func",match:/\b(set|alias|bg|bind|builtin|caller|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|read|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|unset)\b/g},{type:"bool",match:/\b(true|false)\b/g},{type:"func",match:/[a-z_]+(?=\s*\()/g},{type:"oper",match:/[=(){}<>+*/!?~^-]+/g},{type:"var",match:/\w+(?=\s*=)/g},e];var l=[{type:"kwd",match:/^(FROM|RUN|CMD|LABEL|MAINTAINER|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL)\b/gmi},...t];export{l as default};
@@ -0,0 +1 @@
1
+ var t=[{type:"deleted",match:/^[-<].*/gm},{type:"insert",match:/^[+>].*/gm},{type:"kwd",match:/!.*/gm},{type:"section",match:/^@@.*@@$|^\d.*|^([*-+])\1\1.*/gm}];var d=[{match:/^#.*/gm,sub:"todo"},{expand:"str"},...t,{type:"func",match:/^(\$ )?git(\s.*)?$/gm},{type:"kwd",match:/^commit \w+$/gm}];export{d as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{expand:"num"},{type:"kwd",match:/\*|&|\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/g},{type:"func",match:/[a-zA-Z_][\w_]*(?=\s*\()/g},{type:"class",match:/[A-Z][\w_]*/g},{type:"oper",match:/[+\-*\/%&|^~=!<>.^-]+/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var s=`\\s*(\\s+[a-z-]+\\s*(=\\s*([^"']\\S*|("|')(\\\\[^]|(?!\\4)[^])*\\4?)?)?\\s*)*`,t={match:RegExp(`</?[a-z_-]+${s}/?>`,"g"),sub:[{type:"var",match:/^<\/?[^\s>\/]+/g,sub:[{type:"oper",match:/^<\/?/g}]},{type:"str",match:/=\s*([^"']\S*|("|')(\\[^]|(?!\2)[^])*\2?)/g,sub:[{type:"oper",match:/^=/g}]},{type:"oper",match:/\/?>/g},{type:"class",match:/[a-z-]+/gi}]},e=[{match:/<!--((?!-->)[^])*-->/g,sub:"todo"},{type:"class",match:RegExp(`<\\?xml${s}\\?>`,"gi"),sub:[{type:"oper",match:/^<\?|\?>$/g},{type:"str",match:/"[^"]*"|'[^']*'/g},{type:"var",match:/xml/gi}]},{type:"class",match:/<!\[CDATA\[[\s\S]*?\]\]>/gi},t,{type:"var",match:/&(#x?)?[\da-z]{1,8};/gi}];var c=[{type:"class",match:/<!DOCTYPE("[^"]*"|'[^']*'|[^"'>])*>/gi,sub:[{type:"str",match:/"[^"]*"|'[^']*'/g},{type:"oper",match:/^<!|>$/g},{type:"var",match:/DOCTYPE/gi}]},{match:RegExp(`<style${s}>((?!</style>)[^])*</style\\s*>`,"g"),sub:[{match:RegExp(`^<style${s}>`,"g"),sub:t.sub},{match:RegExp(`${t.match}|[^]*(?=</style\\s*>$)`,"g"),sub:"css"},t]},{match:RegExp(`<script${s}>((?!<\/script>)[^])*<\/script\\s*>`,"g"),sub:[{match:RegExp(`^<script${s}>`,"g"),sub:t.sub},{match:RegExp(`${t.match}|[^]*(?=<\/script\\s*>$)`,"g"),sub:"js"},t]},...e];export{c as default};
@@ -0,0 +1 @@
1
+ var r=[["bash",[/#!(\/usr)?\/bin\/bash/g,500],[/\b(if|elif|then|fi|echo)\b|\$/g,10]],["html",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^\s+<!DOCTYPE\s+html/g,500]],["http",[/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g,500]],["js",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g,10]],["ts",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g,10]],["py",[/\b(def|print|class|and|or|lambda)\b/g,10]],["sql",[/\b(SELECT|INSERT|FROM)\b/g,50]],["pl",[/#!(\/usr)?\/bin\/perl/g,500],[/\b(use|print)\b|\$/g,10]],["lua",[/#!(\/usr)?\/bin\/lua/g,500]],["make",[/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm,10]],["uri",[/https?:|mailto:|tel:|ftp:/g,30]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["diff",[/^[+><-]/gm,10],[/^@@ ?[-+,0-9 ]+ ?@@/gm,25]],["md",[/^(>|\t\*|\t\d+.)/gm,10],[/\[.*\](.*)/g,10]],["docker",[/^(FROM|ENTRYPOINT|RUN)/gm,500]],["xml",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^<\?xml/g,500]],["c",[/#include\b|\bprintf\s+\(/g,100]],["rs",[/^\s+(use|fn|mut|match)\b/gm,100]],["go",[/\b(func|fmt|package)\b/g,100]],["java",[/^import\s+java/gm,500]],["asm",[/^(section|global main|extern|\t(call|mov|ret))/gm,100]]],n=s=>{var a;return((a=r.map(([t,...e])=>[e.reduce((g,[m,i])=>g+[...s.matchAll(m)].length*i,0),t]).filter(([t,e])=>t>10).sort((t,e)=>e[0]-t[0])[0])==null?void 0:a[1])||"plain"};var l=[{type:"kwd",match:/^(GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH|PRI|SEARCH)\b/gm},{expand:"str"},{type:"section",match:/\bHTTP\/[\d.]+\b/g},{expand:"num"},{type:"oper",match:/[,;:=]/g},{type:"var",match:/[a-zA-Z][\w-]*(?=:)/g},{match:/\n\n[^]*/g,sub:n}];export{l as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/(^[ \f\t\v]*)[#;].*/gm,sub:"todo"},{type:"str",match:/.*/g},{type:"var",match:/.*(?==)/g},{type:"section",match:/^\s*\[.+\]\s*$/gm},{type:"oper",match:/=/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{expand:"num"},{type:"kwd",match:/\b(abstract|assert|boolean|break|byte|case|catch|char|class|continue|const|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|package|private|protected|public|requires|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|var|void|volatile|while)\b/g},{type:"oper",match:/[/*+:?&|%^~=!,<>.^-]+/g},{type:"func",match:/[a-zA-Z_][\w_]*(?=\s*\()/g},{type:"class",match:/[A-Z][\w_]*/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/\/\*\*((?!\*\/)[^])*(\*\/)?/g,sub:"jsdoc"},{match:/\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{match:/`((?!`)[^]|\\[^])*`?/g,sub:"js_template_literals"},{type:"kwd",match:/=>|\b(this|set|get|as|async|await|break|case|catch|class|const|constructor|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|if|implements|import|in|instanceof|interface|let|var|of|new|package|private|protected|public|return|static|super|switch|throw|throws|try|typeof|void|while|with|yield)\b/g},{match:/\/((?!\/)[^\r\n\\]|\\.)+\/[dgimsuy]*/g,sub:"regex"},{expand:"num"},{type:"num",match:/\b(NaN|null|undefined|[A-Z][A-Z_]*)\b/g},{type:"bool",match:/\b(true|false)\b/g},{type:"oper",match:/[/*+:?&|%^~=!,<>.^-]+/g},{type:"class",match:/\b[A-Z]\w*\b/g},{type:"func",match:/[a-zA-Z$_][\w$_]*(?=\s*((\?\.)?\s*\(|=\s*(\(?[\w,{}\[\])]+\)? =>|function\b)))/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var h=[{match:new class{exec(l){let e=this.lastIndex,t,n=i=>{for(;++e<l.length-2;)if(l[e]=="{")n();else if(l[e]=="}")return};for(;e<l.length;e++)if(l[e-1]!="\\"&&l[e]=="$"&&l[e+1]=="{")return t=e++,n(e),this.lastIndex=e+1,{index:t,0:l.slice(t,e+1)};return null}},sub:[{type:"kwd",match:/^\${|}$/g},{match:/(?!^\$|{)[^]+(?=}$)/g,sub:"js"}]}],a="str";export{h as default,a as type};
@@ -0,0 +1 @@
1
+ var t=[{type:"err",match:/\b(TODO|FIXME|DEBUG|OPTIMIZE|WARNING|XXX|BUG)\b/g},{type:"class",match:/\bIDEA\b/g},{type:"insert",match:/\b(CHANGED|FIX|CHANGE)\b/g},{type:"oper",match:/\bQUESTION\b/g}];var a=[{type:"kwd",match:/@\w+/g},{type:"class",match:/{[\w\s|<>,.@\[\]]+}/g},{type:"var",match:/\[[\w\s="']+\]/g},...t],c="cmnt";export{a as default,c as type};
@@ -0,0 +1 @@
1
+ var t=[{type:"var",match:/("|')?[a-zA-Z]\w*\1(?=\s*:)/g},{expand:"str"},{expand:"num"},{type:"num",match:/\bnull\b/g},{type:"bool",match:/\b(true|false)\b/g}];export{t as default};
@@ -0,0 +1,2 @@
1
+ var p=[["bash",[/#!(\/usr)?\/bin\/bash/g,500],[/\b(if|elif|then|fi|echo)\b|\$/g,10]],["html",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^\s+<!DOCTYPE\s+html/g,500]],["http",[/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g,500]],["js",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g,10]],["ts",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g,10]],["py",[/\b(def|print|class|and|or|lambda)\b/g,10]],["sql",[/\b(SELECT|INSERT|FROM)\b/g,50]],["pl",[/#!(\/usr)?\/bin\/perl/g,500],[/\b(use|print)\b|\$/g,10]],["lua",[/#!(\/usr)?\/bin\/lua/g,500]],["make",[/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm,10]],["uri",[/https?:|mailto:|tel:|ftp:/g,30]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["diff",[/^[+><-]/gm,10],[/^@@ ?[-+,0-9 ]+ ?@@/gm,25]],["md",[/^(>|\t\*|\t\d+.)/gm,10],[/\[.*\](.*)/g,10]],["docker",[/^(FROM|ENTRYPOINT|RUN)/gm,500]],["xml",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^<\?xml/g,500]],["c",[/#include\b|\bprintf\s+\(/g,100]],["rs",[/^\s+(use|fn|mut|match)\b/gm,100]],["go",[/\b(func|fmt|package)\b/g,100]],["java",[/^import\s+java/gm,500]],["asm",[/^(section|global main|extern|\t(call|mov|ret))/gm,100]]],t=a=>{var s;return((s=p.map(([e,...n])=>[n.reduce((l,[g,r])=>l+[...a.matchAll(g)].length*r,0),e]).filter(([e,n])=>e>10).sort((e,n)=>n[0]-e[0])[0])==null?void 0:s[1])||"plain"};var m=[{type:"cmnt",match:/^>.*|(=|-)\1+/gm},{type:"class",match:/\*\*((?!\*\*).)*\*\*/g},{match:/```((?!```)[^])*\n```/g,sub:a=>({type:"kwd",sub:[{match:/\n[^]*(?=```)/g,sub:a.split(`
2
+ `)[0].slice(3)||t(a)}]})},{type:"str",match:/`[^`]*`/g},{type:"var",match:/~~((?!~~).)*~~/g},{type:"kwd",match:/_[^_]*_|\*[^*]*\*/g},{type:"kwd",match:/^\s*(\*|\d+\.)\s/gm},{type:"oper",match:/\[[^\]]*]/g},{type:"func",match:/\([^)]*\)/g}];var o=[{type:"insert",match:/(leanpub-start-insert)((?!leanpub-end-insert)[^])*(leanpub-end-insert)?/g,sub:[{type:"insert",match:/leanpub-(start|end)-insert/g},{match:/(?!leanpub-start-insert)((?!leanpub-end-insert)[^])*/g,sub:t}]},{type:"deleted",match:/(leanpub-start-delete)((?!leanpub-end-delete)[^])*(leanpub-end-delete)?/g,sub:[{type:"deleted",match:/leanpub-(start|end)-delete/g},{match:/(?!leanpub-start-delete)((?!leanpub-end-delete)[^])*/g,sub:t}]},...m];export{o as default};
@@ -0,0 +1 @@
1
+ var e=[{type:"cmnt",match:/^#.*/gm},{expand:"strDouble"},{expand:"num"},{type:"err",match:/\b(err(or)?|[a-z_-]*exception|warn|warning|failed|ko|invalid|not ?found|alert|fatal)\b/gi},{type:"num",match:/\b(null|undefined)\b/gi},{type:"bool",match:/\b(false|true|yes|no)\b/gi},{type:"oper",match:/\.|,/g}];export{e as default};
@@ -0,0 +1 @@
1
+ var e=[{match:/^#!.*|--(\[(=*)\[((?!--\]\2\])[^])*--\]\2\]|.*)/g,sub:"todo"},{expand:"str"},{type:"kwd",match:/\b(and|break|do|else|elseif|end|for|function|if|in|local|not|or|repeat|return|then|until|while)\b/g},{type:"bool",match:/\b(true|false|nil)\b/g},{type:"oper",match:/[+*/%^#=~<>:,.-]+/g},{expand:"num"},{type:"func",match:/[a-z_]+(?=\s*[({])/g}];export{e as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/^\s*#.*/gm,sub:"todo"},{expand:"str"},{type:"oper",match:/[${}()]+/g},{type:"class",match:/.PHONY:/gm},{type:"section",match:/^[\w.]+:/gm},{type:"kwd",match:/\b(ifneq|endif)\b/g},{expand:"num"},{type:"var",match:/[A-Z_]+(?=\s*=)/g},{match:/^.*$/gm,sub:"bash"}];export{t as default};
@@ -0,0 +1,2 @@
1
+ var i=[["bash",[/#!(\/usr)?\/bin\/bash/g,500],[/\b(if|elif|then|fi|echo)\b|\$/g,10]],["html",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^\s+<!DOCTYPE\s+html/g,500]],["http",[/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g,500]],["js",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g,10]],["ts",[/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g,10]],["py",[/\b(def|print|class|and|or|lambda)\b/g,10]],["sql",[/\b(SELECT|INSERT|FROM)\b/g,50]],["pl",[/#!(\/usr)?\/bin\/perl/g,500],[/\b(use|print)\b|\$/g,10]],["lua",[/#!(\/usr)?\/bin\/lua/g,500]],["make",[/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm,10]],["uri",[/https?:|mailto:|tel:|ftp:/g,30]],["css",[/^(@import|@page|@media|(\.|#)[a-z]+)/gm,20]],["diff",[/^[+><-]/gm,10],[/^@@ ?[-+,0-9 ]+ ?@@/gm,25]],["md",[/^(>|\t\*|\t\d+.)/gm,10],[/\[.*\](.*)/g,10]],["docker",[/^(FROM|ENTRYPOINT|RUN)/gm,500]],["xml",[/<\/?[a-z-]+[^\n>]*>/g,10],[/^<\?xml/g,500]],["c",[/#include\b|\bprintf\s+\(/g,100]],["rs",[/^\s+(use|fn|mut|match)\b/gm,100]],["go",[/\b(func|fmt|package)\b/g,100]],["java",[/^import\s+java/gm,500]],["asm",[/^(section|global main|extern|\t(call|mov|ret))/gm,100]]],m=e=>{var s;return((s=i.map(([t,...a])=>[a.reduce((g,[n,c])=>g+[...e.matchAll(n)].length*c,0),t]).filter(([t,a])=>t>10).sort((t,a)=>a[0]-t[0])[0])==null?void 0:s[1])||"plain"};var p=[{type:"cmnt",match:/^>.*|(=|-)\1+/gm},{type:"class",match:/\*\*((?!\*\*).)*\*\*/g},{match:/```((?!```)[^])*\n```/g,sub:e=>({type:"kwd",sub:[{match:/\n[^]*(?=```)/g,sub:e.split(`
2
+ `)[0].slice(3)||m(e)}]})},{type:"str",match:/`[^`]*`/g},{type:"var",match:/~~((?!~~).)*~~/g},{type:"kwd",match:/_[^_]*_|\*[^*]*\*/g},{type:"kwd",match:/^\s*(\*|\d+\.)\s/gm},{type:"oper",match:/\[[^\]]*]/g},{type:"func",match:/\([^)]*\)/g}];export{p as default};
@@ -0,0 +1 @@
1
+ var e=[{match:/#.*/g,sub:"todo"},{type:"str",match:/(["'])(\\[^]|(?!\1)[^])*\1?/g},{expand:"num"},{type:"kwd",match:/\b(any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while|not|and|or|xor)\b/g},{type:"oper",match:/[-+*/%~!&<>|=?,]+/g},{type:"func",match:/[a-z_]+(?=\s*\()/g}];export{e as default};
@@ -0,0 +1 @@
1
+ var e=[{expand:"strDouble"}];export{e as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/#.*/g,sub:"todo"},{match:/("""|''')(\\[^]|(?!\1)[^])*\1?/g,sub:"todo"},{type:"str",match:/f("|')(\\[^]|(?!\1).)*\1?|f((["'])\4\4)(\\[^]|(?!\3)[^])*\3?/gi,sub:[{type:"var",match:/{[^{}]*}/g,sub:[{match:/(?!^{)[^]*(?=}$)/g,sub:"py"}]}]},{expand:"str"},{type:"kwd",match:/\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b/g},{type:"bool",match:/\b(False|True|None)\b/g},{expand:"num"},{type:"func",match:/[a-z_]+(?=\s*\()/g},{type:"oper",match:/[-/*+<>,=!&|^%]+/g},{type:"class",match:/\b[A-Z]\w*\b/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/^(?!\/).*/gm,sub:"todo"},{type:"num",match:/\[((?!\])[^\\]|\\.)*\]/g},{type:"kwd",match:/\||\^|\$|\\.|\w+($|\r|\n)/g},{type:"var",match:/\*|\+|\{\d+,\d+\}/g}],e="oper";export{t as default,e as type};
@@ -0,0 +1 @@
1
+ var e=[{match:/\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{expand:"num"},{type:"kwd",match:/\b(as|break|const|continue|crate|else|enum|extern|false|fn|for|if|impl|in|let|loop|match|mod|move|mut|pub|ref|return|self|Self|static|struct|super|trait|true|type|unsafe|use|where|while|async|await|dyn|abstract|become|box|do|final|macro|override|priv|typeof|unsized|virtual|yield|try)\b/g},{type:"oper",match:/[/*+:?&|%^~=!,<>.^-]+/g},{type:"class",match:/\b[A-Z]\w*\b/g},{type:"func",match:/[a-zA-Z_][\w_]*(?=\s*!?\s*\()/g}];export{e as default};
@@ -0,0 +1 @@
1
+ var E=[{match:/--.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{type:"func",match:/\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/g},{type:"kwd",match:/\b(ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|kwdS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:S|ING)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/g},{type:"num",match:/\.?\d[\d.oxa-fA-F-]*|\bNULL\b/g},{type:"bool",match:/\b(TRUE|FALSE)\b/g},{type:"oper",match:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|IN|ILIKE|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/g},{type:"var",match:/@\S+/g}];export{E as default};
@@ -0,0 +1 @@
1
+ var t=[{type:"err",match:/\b(TODO|FIXME|DEBUG|OPTIMIZE|WARNING|XXX|BUG)\b/g},{type:"class",match:/\bIDEA\b/g},{type:"insert",match:/\b(CHANGED|FIX|CHANGE)\b/g},{type:"oper",match:/\bQUESTION\b/g}],e="cmnt";export{t as default,e as type};
@@ -0,0 +1 @@
1
+ var t=[{match:/#.*/g,sub:"todo"},{type:"str",match:/("""|''')((?!\1)[^]|\\[^])*\1?/g},{expand:"str"},{type:"section",match:/^\[.+\]\s*$/gm},{type:"num",match:/\b(inf|nan)\b|\d[\d:ZT.-]*/g},{expand:"num"},{type:"bool",match:/\b(true|false)\b/g},{type:"oper",match:/[+,.=-]/g},{type:"var",match:/\w+(?= \=)/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var e=[{match:/\/\*\*((?!\*\/)[^])*(\*\/)?/g,sub:"jsdoc"},{match:/\/\/.*\n?|\/\*((?!\*\/)[^])*(\*\/)?/g,sub:"todo"},{expand:"str"},{match:/`((?!`)[^]|\\[^])*`?/g,sub:"js_template_literals"},{type:"kwd",match:/=>|\b(this|set|get|as|async|await|break|case|catch|class|const|constructor|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|if|implements|import|in|instanceof|interface|let|var|of|new|package|private|protected|public|return|static|super|switch|throw|throws|try|typeof|void|while|with|yield)\b/g},{match:/\/((?!\/)[^\r\n\\]|\\.)+\/[dgimsuy]*/g,sub:"regex"},{expand:"num"},{type:"num",match:/\b(NaN|null|undefined|[A-Z][A-Z_]*)\b/g},{type:"bool",match:/\b(true|false)\b/g},{type:"oper",match:/[/*+:?&|%^~=!,<>.^-]+/g},{type:"class",match:/\b[A-Z]\w*\b/g},{type:"func",match:/[a-zA-Z$_][\w$_]*(?=\s*((\?\.)?\s*\(|=\s*(\(?[\w,{}\[\])]+\)? =>|function\b)))/g}];var c=[{type:"type",match:/:\s*(any|void|number|boolean|string|object|never|enum)\b/g},{type:"kwd",match:/\b(type|namespace|typedef|interface|public|private|protected|implements|declare|abstract|readonly)\b/g},...e];export{c as default};
@@ -0,0 +1 @@
1
+ var t=[{match:/^#.*/gm,sub:"todo"},{type:"class",match:/^\w+(?=:?)/gm},{type:"num",match:/:\d+/g},{type:"oper",match:/[:/&?]|\w+=/g},{type:"func",match:/[.\w]+@|#[\w]+$/gm},{type:"var",match:/\w+\.\w+(\.\w+)*/g}];export{t as default};
@@ -0,0 +1 @@
1
+ var t=`\\s*(\\s+[a-z-]+\\s*(=\\s*([^"']\\S*|("|')(\\\\[^]|(?!\\4)[^])*\\4?)?)?\\s*)*`,a={match:RegExp(`</?[a-z_-]+${t}/?>`,"g"),sub:[{type:"var",match:/^<\/?[^\s>\/]+/g,sub:[{type:"oper",match:/^<\/?/g}]},{type:"str",match:/=\s*([^"']\S*|("|')(\\[^]|(?!\2)[^])*\2?)/g,sub:[{type:"oper",match:/^=/g}]},{type:"oper",match:/\/?>/g},{type:"class",match:/[a-z-]+/gi}]},e=[{match:/<!--((?!-->)[^])*-->/g,sub:"todo"},{type:"class",match:RegExp(`<\\?xml${t}\\?>`,"gi"),sub:[{type:"oper",match:/^<\?|\?>$/g},{type:"str",match:/"[^"]*"|'[^']*'/g},{type:"var",match:/xml/gi}]},{type:"class",match:/<!\[CDATA\[[\s\S]*?\]\]>/gi},a,{type:"var",match:/&(#x?)?[\da-z]{1,8};/gi}];export{e as default,t as property,a as xmlElement};
@@ -0,0 +1 @@
1
+ var t=[{match:/#.*/g,sub:"todo"},{expand:"str"},{type:"str",match:/(>|\|)\r?\n((\s[^\n]*)?(\r?\n|$))*/g},{type:"type",match:/!![a-z]+/g},{type:"bool",match:/\b(Yes|No)\b/g},{type:"oper",match:/[+:-]/g},{expand:"num"},{type:"var",match:/[a-zA-Z]\w*(?=:)/g}];export{t as default};