@scalar/highlight 0.2.0

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 (166) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +324 -0
  3. package/dist/all.d.ts +28 -0
  4. package/dist/all.d.ts.map +1 -0
  5. package/dist/all.js +105 -0
  6. package/dist/compat/hljs.d.ts +24 -0
  7. package/dist/compat/hljs.d.ts.map +1 -0
  8. package/dist/compat/hljs.js +95 -0
  9. package/dist/compat/index.d.ts +24 -0
  10. package/dist/compat/index.d.ts.map +1 -0
  11. package/dist/compat/index.js +21 -0
  12. package/dist/compat/languages.d.ts +46 -0
  13. package/dist/compat/languages.d.ts.map +1 -0
  14. package/dist/compat/languages.js +236 -0
  15. package/dist/compat/syntax-highlight.d.ts +37 -0
  16. package/dist/compat/syntax-highlight.d.ts.map +1 -0
  17. package/dist/compat/syntax-highlight.js +133 -0
  18. package/dist/core/compile.d.ts +3 -0
  19. package/dist/core/compile.d.ts.map +1 -0
  20. package/dist/core/compile.js +142 -0
  21. package/dist/core/index.d.ts +9 -0
  22. package/dist/core/index.d.ts.map +1 -0
  23. package/dist/core/index.js +5 -0
  24. package/dist/core/registry.d.ts +14 -0
  25. package/dist/core/registry.d.ts.map +1 -0
  26. package/dist/core/registry.js +77 -0
  27. package/dist/core/render.d.ts +67 -0
  28. package/dist/core/render.d.ts.map +1 -0
  29. package/dist/core/render.js +216 -0
  30. package/dist/core/scopes.d.ts +94 -0
  31. package/dist/core/scopes.d.ts.map +1 -0
  32. package/dist/core/scopes.js +113 -0
  33. package/dist/core/tokenize.d.ts +18 -0
  34. package/dist/core/tokenize.d.ts.map +1 -0
  35. package/dist/core/tokenize.js +131 -0
  36. package/dist/core/types.d.ts +99 -0
  37. package/dist/core/types.d.ts.map +1 -0
  38. package/dist/core/types.js +10 -0
  39. package/dist/index.d.ts +19 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +20 -0
  42. package/dist/langs/bash.d.ts +4 -0
  43. package/dist/langs/bash.d.ts.map +1 -0
  44. package/dist/langs/bash.js +123 -0
  45. package/dist/langs/c.d.ts +4 -0
  46. package/dist/langs/c.d.ts.map +1 -0
  47. package/dist/langs/c.js +196 -0
  48. package/dist/langs/clojure.d.ts +4 -0
  49. package/dist/langs/clojure.d.ts.map +1 -0
  50. package/dist/langs/clojure.js +213 -0
  51. package/dist/langs/cpp.d.ts +4 -0
  52. package/dist/langs/cpp.d.ts.map +1 -0
  53. package/dist/langs/cpp.js +391 -0
  54. package/dist/langs/csharp.d.ts +4 -0
  55. package/dist/langs/csharp.d.ts.map +1 -0
  56. package/dist/langs/csharp.js +307 -0
  57. package/dist/langs/css.d.ts +4 -0
  58. package/dist/langs/css.d.ts.map +1 -0
  59. package/dist/langs/css.js +94 -0
  60. package/dist/langs/dart.d.ts +4 -0
  61. package/dist/langs/dart.d.ts.map +1 -0
  62. package/dist/langs/dart.js +262 -0
  63. package/dist/langs/diff.d.ts +10 -0
  64. package/dist/langs/diff.d.ts.map +1 -0
  65. package/dist/langs/diff.js +26 -0
  66. package/dist/langs/dockerfile.d.ts +4 -0
  67. package/dist/langs/dockerfile.d.ts.map +1 -0
  68. package/dist/langs/dockerfile.js +308 -0
  69. package/dist/langs/elixir.d.ts +4 -0
  70. package/dist/langs/elixir.d.ts.map +1 -0
  71. package/dist/langs/elixir.js +343 -0
  72. package/dist/langs/fsharp.d.ts +4 -0
  73. package/dist/langs/fsharp.d.ts.map +1 -0
  74. package/dist/langs/fsharp.js +330 -0
  75. package/dist/langs/go.d.ts +5 -0
  76. package/dist/langs/go.d.ts.map +1 -0
  77. package/dist/langs/go.js +90 -0
  78. package/dist/langs/graphql.d.ts +4 -0
  79. package/dist/langs/graphql.d.ts.map +1 -0
  80. package/dist/langs/graphql.js +185 -0
  81. package/dist/langs/haskell.d.ts +4 -0
  82. package/dist/langs/haskell.d.ts.map +1 -0
  83. package/dist/langs/haskell.js +375 -0
  84. package/dist/langs/html.d.ts +14 -0
  85. package/dist/langs/html.d.ts.map +1 -0
  86. package/dist/langs/html.js +71 -0
  87. package/dist/langs/http.d.ts +4 -0
  88. package/dist/langs/http.d.ts.map +1 -0
  89. package/dist/langs/http.js +185 -0
  90. package/dist/langs/ini.d.ts +4 -0
  91. package/dist/langs/ini.d.ts.map +1 -0
  92. package/dist/langs/ini.js +227 -0
  93. package/dist/langs/java.d.ts +4 -0
  94. package/dist/langs/java.d.ts.map +1 -0
  95. package/dist/langs/java.js +178 -0
  96. package/dist/langs/javascript.d.ts +4 -0
  97. package/dist/langs/javascript.d.ts.map +1 -0
  98. package/dist/langs/javascript.js +226 -0
  99. package/dist/langs/json.d.ts +10 -0
  100. package/dist/langs/json.d.ts.map +1 -0
  101. package/dist/langs/json.js +46 -0
  102. package/dist/langs/kotlin.d.ts +4 -0
  103. package/dist/langs/kotlin.d.ts.map +1 -0
  104. package/dist/langs/kotlin.js +220 -0
  105. package/dist/langs/lua.d.ts +4 -0
  106. package/dist/langs/lua.d.ts.map +1 -0
  107. package/dist/langs/lua.js +330 -0
  108. package/dist/langs/makefile.d.ts +4 -0
  109. package/dist/langs/makefile.d.ts.map +1 -0
  110. package/dist/langs/makefile.js +266 -0
  111. package/dist/langs/markdown.d.ts +11 -0
  112. package/dist/langs/markdown.d.ts.map +1 -0
  113. package/dist/langs/markdown.js +71 -0
  114. package/dist/langs/matlab.d.ts +4 -0
  115. package/dist/langs/matlab.d.ts.map +1 -0
  116. package/dist/langs/matlab.js +352 -0
  117. package/dist/langs/mojo.d.ts +4 -0
  118. package/dist/langs/mojo.d.ts.map +1 -0
  119. package/dist/langs/mojo.js +337 -0
  120. package/dist/langs/nginx.d.ts +4 -0
  121. package/dist/langs/nginx.d.ts.map +1 -0
  122. package/dist/langs/nginx.js +168 -0
  123. package/dist/langs/objectivec.d.ts +4 -0
  124. package/dist/langs/objectivec.d.ts.map +1 -0
  125. package/dist/langs/objectivec.js +287 -0
  126. package/dist/langs/ocaml.d.ts +4 -0
  127. package/dist/langs/ocaml.d.ts.map +1 -0
  128. package/dist/langs/ocaml.js +309 -0
  129. package/dist/langs/perl.d.ts +4 -0
  130. package/dist/langs/perl.d.ts.map +1 -0
  131. package/dist/langs/perl.js +435 -0
  132. package/dist/langs/php.d.ts +4 -0
  133. package/dist/langs/php.d.ts.map +1 -0
  134. package/dist/langs/php.js +325 -0
  135. package/dist/langs/powershell.d.ts +4 -0
  136. package/dist/langs/powershell.d.ts.map +1 -0
  137. package/dist/langs/powershell.js +308 -0
  138. package/dist/langs/python.d.ts +4 -0
  139. package/dist/langs/python.d.ts.map +1 -0
  140. package/dist/langs/python.js +350 -0
  141. package/dist/langs/r.d.ts +4 -0
  142. package/dist/langs/r.d.ts.map +1 -0
  143. package/dist/langs/r.js +265 -0
  144. package/dist/langs/ruby.d.ts +4 -0
  145. package/dist/langs/ruby.d.ts.map +1 -0
  146. package/dist/langs/ruby.js +365 -0
  147. package/dist/langs/rust.d.ts +10 -0
  148. package/dist/langs/rust.d.ts.map +1 -0
  149. package/dist/langs/rust.js +116 -0
  150. package/dist/langs/scala.d.ts +4 -0
  151. package/dist/langs/scala.d.ts.map +1 -0
  152. package/dist/langs/scala.js +308 -0
  153. package/dist/langs/sql.d.ts +5 -0
  154. package/dist/langs/sql.d.ts.map +1 -0
  155. package/dist/langs/sql.js +57 -0
  156. package/dist/langs/swift.d.ts +33 -0
  157. package/dist/langs/swift.d.ts.map +1 -0
  158. package/dist/langs/swift.js +256 -0
  159. package/dist/langs/yaml.d.ts +11 -0
  160. package/dist/langs/yaml.d.ts.map +1 -0
  161. package/dist/langs/yaml.js +123 -0
  162. package/dist/lazy.d.ts +69 -0
  163. package/dist/lazy.d.ts.map +1 -0
  164. package/dist/lazy.js +200 -0
  165. package/dist/style.css +308 -0
  166. package/package.json +86 -0
@@ -0,0 +1,266 @@
1
+ /**
2
+ * GNU Make.
3
+ *
4
+ * Two characters carry almost all of the meaning in a Makefile, and both are
5
+ * badly overloaded:
6
+ *
7
+ * - `:` separates a target from its prerequisites, but `:=`, `::=` and `:::=`
8
+ * are assignments and `$(SRCS:.c=.o)` is a substitution reference.
9
+ * Assignments are matched first, and a rule line is entered through a
10
+ * lookahead that only fires when a bare `:` really does arrive before any
11
+ * `=` or `#`.
12
+ * - `$` introduces an automatic variable (`$@`), a reference (`$(CC)`), a
13
+ * function call (`$(shell …)`) or its own escape (`$$`). All four live in one
14
+ * shared `common` state so every context — recipe, prerequisite list, `define`
15
+ * body, nested argument — expands identically.
16
+ *
17
+ * Recipe lines are shell, so the leading tab pushes a state that is left again
18
+ * at the end of the line.
19
+ *
20
+ * Where it is knowingly wrong: make strips backslash-newline before deciding
21
+ * what a line is, and this tokenizer does not. A continuation is consumed
22
+ * together with the next line's indentation, which keeps a tab-indented
23
+ * continuation of a variable value from reading as a recipe, but a continued
24
+ * line that itself looks like an assignment or a rule is still scoped as one.
25
+ * That is the ordinary-code reading; code written to defeat it renders wrong
26
+ * rather than dangerously.
27
+ */
28
+ /**
29
+ * Variable and target names. The length cap matters: the rules using it are
30
+ * line-anchored scans that end in a required character, and an uncapped scan
31
+ * re-reads the whole line before failing on a line that never supplies it.
32
+ */
33
+ const NAME = '[A-Za-z_.][\\w.-]{0,120}';
34
+ /**
35
+ * Make's builtin functions.
36
+ *
37
+ * Ordered so that a name which is a prefix of another comes second
38
+ * (`filter-out` before `filter`, `wordlist` before `word`) — the trailing
39
+ * lookahead would backtrack into the longer branch anyway, but relying on that
40
+ * makes the list fragile to edit.
41
+ */
42
+ const FUNCTION = 'abspath|addprefix|addsuffix|and|basename|call|dir|error|eval|file|filter-out|filter|findstring|firstword|flavor|foreach|info|if|join|lastword|notdir|origin|or|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|wordlist|words|word';
43
+ /** `$@ $< $^ $* $? $% $+ $|` — the automatic variables, minus `$$`. */
44
+ const AUTO = '[@<^*?%+|]';
45
+ const makefile = {
46
+ name: 'makefile',
47
+ aliases: ['make', 'mk', 'bsdmake'],
48
+ states: {
49
+ root: {
50
+ rules: [
51
+ // A leading tab is what makes a line a recipe, whatever it holds, so
52
+ // this outranks every other line-shaped rule. `@`, `-` and `+` are
53
+ // make's prefixes rather than part of the command.
54
+ {
55
+ match: '^(\\t[ \\t]*)([-@+]*)',
56
+ scope: [null, 'operator'],
57
+ push: 'recipe',
58
+ },
59
+ { match: '#[^\\n]*', scope: 'comment' },
60
+ // Assignments outrank every other line shape, and not only because
61
+ // `:=`, `::=` and `:::=` open with the character that otherwise means
62
+ // "target": a variable is allowed to be called `ifeq`, and going first
63
+ // is what stops `ifeq ?= yes` from reading as a conditional. Nothing
64
+ // below loses out, because a directive never carries an operator
65
+ // directly after its first word. `export`/`override` are folded in so
66
+ // `export CFLAGS += -g` still scopes the variable it assigns to.
67
+ {
68
+ match: `^([ \\t]*)(?:(export|override|private|unexport)([ \\t]+))?(${NAME})([ \\t]*)(:{1,3}=|[+?!]?=)`,
69
+ scope: [null, 'keyword', null, 'variable', null, 'operator'],
70
+ },
71
+ // `else ifeq` is one directive, not two. The guard keeps a target that
72
+ // happens to be called `ifeq:` out of the keyword rules.
73
+ {
74
+ match: '^[ \\t]*(?:else[ \\t]+)?ifn?eq\\b(?![ \\t]*:)',
75
+ scope: 'keyword.control',
76
+ push: 'condition',
77
+ },
78
+ {
79
+ match: '^[ \\t]*(?:else[ \\t]+)?(?:ifn?def|else|endif)\\b(?![ \\t]*:)',
80
+ scope: 'keyword.control',
81
+ },
82
+ // The same `(?![ \t]*:)` guard as the conditionals: `include` is an
83
+ // ordinary word, and `include: build` is a rule with a target called
84
+ // `include` rather than a directive.
85
+ {
86
+ match: '^[ \\t]*[-s]?include\\b(?![ \\t]*:)',
87
+ scope: 'keyword.import',
88
+ },
89
+ // A `define` body needs a state rather than a backreference: the
90
+ // terminator is always the literal word `endef`, so nothing has to
91
+ // remember the variable's name.
92
+ {
93
+ match: `^([ \\t]*)(define)([ \\t]+)(${NAME})`,
94
+ scope: [null, 'keyword.declaration', null, 'variable'],
95
+ push: 'define',
96
+ },
97
+ // The same directives standing alone, without an assignment after them,
98
+ // and guarded the same way: any of these is a legal target name.
99
+ {
100
+ match: '^[ \\t]*(?:unexport|override|export|private|undefine|vpath)\\b(?![ \\t]*:)',
101
+ scope: 'keyword',
102
+ },
103
+ // A rule line, recognised by a `:` reached before any `=` or `#`. The
104
+ // match is zero-width so the `target` state owns the name itself and
105
+ // `$(BUILD)/%.o` keeps expanding inside it. The line anchor means the
106
+ // lookahead runs once per line rather than once per column, and the cap
107
+ // bounds that one run so a pathologically long line cannot pay for it.
108
+ { match: '^(?=[ \\t]*[^\\s:#=][^:#=\\n]{0,120}:)', push: 'target' },
109
+ { include: 'common' },
110
+ ],
111
+ },
112
+ /**
113
+ * The target side of a rule line. Everything unmatched is the target name,
114
+ * which is why `$(BIN)` and `%` can be pulled out of it by rule.
115
+ */
116
+ target: {
117
+ default: 'function',
118
+ rules: [
119
+ // `.PHONY`, `.SUFFIXES`, … — make's own targets, which are never
120
+ // indented, so the line anchor is enough to tell them from a file
121
+ // called `.hidden`.
122
+ { match: '^\\.[A-Z][A-Z_]+', scope: 'function.builtin' },
123
+ // The stem of a pattern rule, not a character of the name.
124
+ { match: '%', scope: 'operator' },
125
+ { match: '::?', scope: 'punctuation.delimiter', set: 'prereqs' },
126
+ { include: 'common' },
127
+ // Only a continuation extends a rule line, and `common` has already
128
+ // consumed those by the time this is reached.
129
+ { match: '$', pop: true },
130
+ ],
131
+ },
132
+ prereqs: {
133
+ rules: [
134
+ { match: '#[^\\n]*', scope: 'comment' },
135
+ // `%` is the pattern stem; `|` opens the order-only prerequisites.
136
+ { match: '[%|]', scope: 'operator' },
137
+ // `target: deps ; cmd` puts the recipe on the rule line itself.
138
+ { match: ';', scope: 'punctuation.delimiter', set: 'recipe' },
139
+ { include: 'common' },
140
+ { match: '$', pop: true },
141
+ ],
142
+ },
143
+ /** `ifeq (a,b)` — scoped so the argument brackets read as brackets. */
144
+ condition: {
145
+ rules: [
146
+ // The state holds to the end of the line, so a trailing comment never
147
+ // reaches root's rule and has to be recognised here.
148
+ { match: '#[^\\n]*', scope: 'comment' },
149
+ { match: '[()]', scope: 'punctuation.bracket' },
150
+ { match: ',', scope: 'punctuation.delimiter' },
151
+ { include: 'common' },
152
+ { match: '$', pop: true },
153
+ ],
154
+ },
155
+ recipe: {
156
+ rules: [
157
+ // The shell's comment rather than make's: `#` only opens one at the
158
+ // start of a word, so `url#frag` stays intact.
159
+ { match: '(?:^|[ \\t])#[^\\n]*', scope: 'comment' },
160
+ { include: 'common' },
161
+ { match: '"', scope: 'string', push: 'string-double' },
162
+ { match: "'", scope: 'string', push: 'string-single' },
163
+ { match: '$', pop: true },
164
+ ],
165
+ },
166
+ 'string-double': {
167
+ default: 'string',
168
+ rules: [
169
+ { match: '\\\\[\\\\$`"]', scope: 'string.escape' },
170
+ { include: 'common' },
171
+ { match: '"', scope: 'string', pop: true },
172
+ // An unterminated quote stops at the line break instead of swallowing
173
+ // the rest of the file.
174
+ { match: '$', pop: true },
175
+ ],
176
+ },
177
+ 'string-single': {
178
+ default: 'string',
179
+ // The shell keeps single quotes literal, but make expands `$(…)` inside
180
+ // them before the shell ever sees the line, so `common` still applies.
181
+ rules: [{ include: 'common' }, { match: "'", scope: 'string', pop: true }, { match: '$', pop: true }],
182
+ },
183
+ define: {
184
+ rules: [
185
+ { match: '^[ \\t]*endef\\b', scope: 'keyword.declaration', pop: true },
186
+ { match: '#[^\\n]*', scope: 'comment' },
187
+ { include: 'common' },
188
+ ],
189
+ },
190
+ /** Everything `$` can start, plus the line continuation. Shared by every state. */
191
+ common: {
192
+ rules: [
193
+ // `$$` is make's escape for a literal `$`, so it has to outrank `$(`.
194
+ { match: '\\$\\$', scope: 'string.escape' },
195
+ // `$(@D)`, `$(<F)` — the directory and file halves of an automatic
196
+ // variable, which would otherwise read as a one-letter reference.
197
+ { match: `\\$[({]${AUTO}[DF][)}]`, scope: 'variable.builtin' },
198
+ { match: `\\$${AUTO}`, scope: 'variable.builtin' },
199
+ // Make requires whitespace between a function name and its first
200
+ // argument, and that is the whole difference between `$(shell cmd)` and
201
+ // a variable named `$(shellcheck)`.
202
+ {
203
+ match: `(\\$\\()(${FUNCTION})(?=[ \\t])`,
204
+ scope: ['punctuation.bracket', 'function.builtin'],
205
+ push: 'args-paren',
206
+ },
207
+ {
208
+ match: `(\\$\\{)(${FUNCTION})(?=[ \\t])`,
209
+ scope: ['punctuation.bracket', 'function.builtin'],
210
+ push: 'args-brace',
211
+ },
212
+ // Paren and brace forms get their own states because make requires the
213
+ // delimiters to match and a backreference cannot be used to say so.
214
+ { match: '\\$\\(', scope: 'variable', push: 'ref-paren' },
215
+ { match: '\\$\\{', scope: 'variable', push: 'ref-brace' },
216
+ // `$X` — a one-character reference needs no brackets at all.
217
+ { match: '\\$[A-Za-z_]', scope: 'variable' },
218
+ // The next line's indentation is swallowed with the continuation so a
219
+ // tab-indented continued value is not mistaken for a recipe. Every
220
+ // line-shaped state pops on `$`, which sits after this position, so
221
+ // leftmost-match ordering lets the continuation win.
222
+ { match: '(\\\\\\r?\\n)[ \\t]*', scope: ['operator'] },
223
+ ],
224
+ },
225
+ 'ref-paren': {
226
+ default: 'variable',
227
+ rules: [
228
+ { match: '\\)', scope: 'variable', pop: true },
229
+ // `$(SRCS:.c=.o)` — a substitution reference.
230
+ { match: '[:=%]', scope: 'operator' },
231
+ { include: 'common' },
232
+ { match: '$', pop: true },
233
+ ],
234
+ },
235
+ 'ref-brace': {
236
+ default: 'variable',
237
+ rules: [
238
+ { match: '\\}', scope: 'variable', pop: true },
239
+ { match: '[:=%]', scope: 'operator' },
240
+ { include: 'common' },
241
+ { match: '$', pop: true },
242
+ ],
243
+ },
244
+ // Function arguments are ordinary text — paths, patterns, shell commands —
245
+ // so they carry no default scope, only the separators that structure them.
246
+ 'args-paren': {
247
+ rules: [
248
+ { match: '\\)', scope: 'punctuation.bracket', pop: true },
249
+ { match: ',', scope: 'punctuation.delimiter' },
250
+ { match: '%', scope: 'operator' },
251
+ { include: 'common' },
252
+ { match: '$', pop: true },
253
+ ],
254
+ },
255
+ 'args-brace': {
256
+ rules: [
257
+ { match: '\\}', scope: 'punctuation.bracket', pop: true },
258
+ { match: ',', scope: 'punctuation.delimiter' },
259
+ { match: '%', scope: 'operator' },
260
+ { include: 'common' },
261
+ { match: '$', pop: true },
262
+ ],
263
+ },
264
+ },
265
+ };
266
+ export default makefile;
@@ -0,0 +1,11 @@
1
+ import type { Grammar } from '../core/types.js';
2
+ /**
3
+ * Markdown.
4
+ *
5
+ * Prose is left alone; only the marks are styled. Fenced code blocks become a
6
+ * literal state so their contents are never mistaken for Markdown syntax —
7
+ * highlighting the fence body with its own language is a follow-up.
8
+ */
9
+ declare const markdown: Grammar;
10
+ export default markdown;
11
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/langs/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C;;;;;;GAMG;AACH,QAAA,MAAM,QAAQ,EAAE,OAqEf,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Markdown.
3
+ *
4
+ * Prose is left alone; only the marks are styled. Fenced code blocks become a
5
+ * literal state so their contents are never mistaken for Markdown syntax —
6
+ * highlighting the fence body with its own language is a follow-up.
7
+ */
8
+ const markdown = {
9
+ name: 'markdown',
10
+ aliases: ['md', 'mdx'],
11
+ states: {
12
+ root: {
13
+ rules: [
14
+ {
15
+ match: '^([ \\t]*)(```+|~~~+)([^\\n]*)$',
16
+ scope: [null, 'punctuation', 'type'],
17
+ push: 'fence',
18
+ },
19
+ { match: '^#{1,6}[ \\t][^\\n]*', scope: 'heading' },
20
+ { match: '^[^\\n]+\\n(?:={2,}|-{2,})[ \\t]*$', scope: 'heading' },
21
+ {
22
+ match: '^[ \\t]*(?:\\*[ \\t]*){3,}$|^[ \\t]*(?:-[ \\t]*){3,}$|^[ \\t]*(?:_[ \\t]*){3,}$',
23
+ scope: 'punctuation',
24
+ },
25
+ { match: '^[ \\t]*>[ \\t]?', scope: 'quote' },
26
+ {
27
+ match: '^([ \\t]*)([-*+]|\\d+[.)])(?=[ \\t])',
28
+ scope: [null, 'list'],
29
+ },
30
+ { match: '`+[^`\\n]+`+', scope: 'string' },
31
+ // The label excludes `[` as well as `]`. Allowing it would let a line
32
+ // of `[` cost O(n) per bracket — the scan runs to the end of the line
33
+ // and then fails for want of a `]` — which is quadratic on input a
34
+ // docs pipeline does not control. Stopping at the next `[` also reads
35
+ // an unbalanced `[a[b](c)` the way CommonMark does, as a link starting
36
+ // at the inner bracket.
37
+ {
38
+ match: '(!?\\[)([^[\\]\\n]*)(\\])(\\()([^)\\n]*)(\\))',
39
+ scope: ['punctuation', 'link', 'punctuation', 'punctuation', 'string', 'punctuation'],
40
+ },
41
+ {
42
+ match: '(!?\\[)([^[\\]\\n]*)(\\])(\\[)([^[\\]\\n]*)(\\])',
43
+ scope: ['punctuation', 'link', 'punctuation', 'punctuation', 'variable', 'punctuation'],
44
+ },
45
+ { match: '<https?://[^>\\n]+>', scope: 'link' },
46
+ {
47
+ match: '^(\\[)([^\\]\\n]+)(\\]:)([^\\n]*)',
48
+ scope: ['punctuation', 'variable', 'punctuation', 'string'],
49
+ },
50
+ { match: '\\*\\*\\*[^*\\n]+\\*\\*\\*|___[^_\\n]+___', scope: 'strong' },
51
+ { match: '\\*\\*[^*\\n]+\\*\\*|__[^_\\n]+__', scope: 'strong' },
52
+ { match: '\\*[^*\\n]+\\*|(?:^|[\\s(])_[^_\\n]+_', scope: 'emphasis' },
53
+ { match: '~~[^~\\n]+~~', scope: 'comment' },
54
+ { match: '^([ \\t]*)(\\|)', scope: [null, 'punctuation'] },
55
+ { match: '\\|', scope: 'punctuation' },
56
+ { match: '</?[A-Za-z][\\w:-]*(?:\\s[^>\\n]*)?/?>', scope: 'tag' },
57
+ ],
58
+ },
59
+ fence: {
60
+ default: 'string',
61
+ rules: [
62
+ {
63
+ match: '^[ \\t]*(?:```+|~~~+)[ \\t]*$',
64
+ scope: 'punctuation',
65
+ pop: true,
66
+ },
67
+ ],
68
+ },
69
+ },
70
+ };
71
+ export default markdown;
@@ -0,0 +1,4 @@
1
+ import type { Grammar } from '../core/types.js';
2
+ declare const matlab: Grammar;
3
+ export default matlab;
4
+ //# sourceMappingURL=matlab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matlab.d.ts","sourceRoot":"","sources":["../../src/langs/matlab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAuG5C,QAAA,MAAM,MAAM,EAAE,OAgSb,CAAA;AAED,eAAe,MAAM,CAAA"}