@fuzdev/fuz_code 0.45.1 → 0.46.1

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 (39) hide show
  1. package/README.md +1 -0
  2. package/dist/Code.svelte +2 -2
  3. package/dist/Code.svelte.d.ts +2 -2
  4. package/dist/CodeHighlight.svelte +18 -54
  5. package/dist/CodeHighlight.svelte.d.ts +4 -4
  6. package/dist/CodeHighlight.svelte.d.ts.map +1 -1
  7. package/dist/CodeTextarea.svelte +149 -0
  8. package/dist/CodeTextarea.svelte.d.ts +43 -0
  9. package/dist/CodeTextarea.svelte.d.ts.map +1 -0
  10. package/dist/grammar_markdown.js +3 -3
  11. package/dist/grammar_markup.d.ts +8 -7
  12. package/dist/grammar_markup.d.ts.map +1 -1
  13. package/dist/grammar_markup.js +8 -7
  14. package/dist/highlight_manager.d.ts +21 -7
  15. package/dist/highlight_manager.d.ts.map +1 -1
  16. package/dist/highlight_manager.js +130 -74
  17. package/dist/range_highlighting.svelte.d.ts +39 -0
  18. package/dist/range_highlighting.svelte.d.ts.map +1 -0
  19. package/dist/range_highlighting.svelte.js +57 -0
  20. package/dist/svelte_preprocess_fuz_code.d.ts +4 -4
  21. package/dist/svelte_preprocess_fuz_code.d.ts.map +1 -1
  22. package/dist/svelte_preprocess_fuz_code.js +3 -3
  23. package/dist/syntax_styler.d.ts +40 -32
  24. package/dist/syntax_styler.d.ts.map +1 -1
  25. package/dist/syntax_styler.js +81 -49
  26. package/dist/syntax_token.d.ts +4 -4
  27. package/dist/syntax_token.js +2 -2
  28. package/dist/tokenize_syntax.d.ts +2 -4
  29. package/dist/tokenize_syntax.d.ts.map +1 -1
  30. package/dist/tokenize_syntax.js +2 -4
  31. package/package.json +27 -29
  32. package/src/lib/grammar_markdown.ts +3 -3
  33. package/src/lib/grammar_markup.ts +8 -7
  34. package/src/lib/highlight_manager.ts +154 -84
  35. package/src/lib/range_highlighting.svelte.ts +100 -0
  36. package/src/lib/svelte_preprocess_fuz_code.ts +6 -6
  37. package/src/lib/syntax_styler.ts +98 -53
  38. package/src/lib/syntax_token.ts +4 -4
  39. package/src/lib/tokenize_syntax.ts +2 -4
@@ -1,5 +1,11 @@
1
1
  import { SyntaxToken } from './syntax_token.js';
2
2
  import { tokenize_syntax } from './tokenize_syntax.js';
3
+ /**
4
+ * Maps a matched `&`, `<`, or non-breaking space in text content to its
5
+ * HTML-safe form. Used as the replacer in `stringify_token` for leaf strings
6
+ * (non-breaking spaces are normalized to a regular space).
7
+ */
8
+ const escape_text_char = (ch) => (ch === '&' ? '&amp;' : ch === '<' ? '&lt;' : ' ');
3
9
  /**
4
10
  * Based on Prism (https://github.com/PrismJS/prism)
5
11
  * by Lea Verou (https://lea.verou.me/)
@@ -79,15 +85,14 @@ export class SyntaxStyler {
79
85
  * - Custom grammar: `stylize(code, 'ts', customGrammar)` - uses custom grammar but keeps 'ts' label
80
86
  * - Extended grammar: `stylize(code, 'custom', this.extend_grammar('ts', extension))` - new language variant
81
87
  *
82
- * @param text - The source code to syntax highlight.
83
- * @param lang - Language identifier (e.g., 'ts', 'css', 'html'). Used for:
84
- * - Grammar lookup when `grammar` is undefined
85
- * - Hook context (`lang` field passed to hooks)
86
- * - Language identification in output
87
- * @param grammar - Optional custom grammar object. When undefined, automatically
88
- * looks up the grammar via `this.get_lang(lang)`. Provide this to use a custom
89
- * or modified grammar instead of the registered one.
90
- *
88
+ * @param text - the source code to syntax highlight
89
+ * @param lang - language identifier (e.g., 'ts', 'css', 'html'), used for:
90
+ * - grammar lookup when `grammar` is undefined
91
+ * - hook context (`lang` field passed to hooks)
92
+ * - language identification in output
93
+ * @param grammar - optional custom `SyntaxGrammar` object; when undefined, automatically
94
+ * looks up the grammar via `this.get_lang(lang)`; provide this to use a custom
95
+ * or modified grammar instead of the registered one
91
96
  * @returns HTML string with syntax highlighting using CSS classes (`.token_*`)
92
97
  *
93
98
  * @example
@@ -111,7 +116,32 @@ export class SyntaxStyler {
111
116
  * ```
112
117
  */
113
118
  stylize(text, lang, grammar = this.get_lang(lang)) {
114
- var ctx = {
119
+ // stringify with the post-hook `lang`, which a `before_tokenize` hook may
120
+ // have rewritten (it flows into each token's `wrap` hook context)
121
+ const c = this.#tokenize_hooked(text, lang, grammar);
122
+ return this.stringify_token(c.tokens, c.lang);
123
+ }
124
+ /**
125
+ * Tokenizes `text` into a `SyntaxTokenStream`, running the `before_tokenize`
126
+ * and `after_tokenize` hooks. This is the tokenization half of `stylize` — use
127
+ * it when you need the token stream itself (e.g. CSS Custom Highlight API range
128
+ * highlighting) rather than HTML.
129
+ *
130
+ * @param text - source to tokenize
131
+ * @param lang - language identifier; passed to the tokenize hooks
132
+ * @param grammar - grammar to tokenize with; defaults to `this.get_lang(lang)`
133
+ * @returns the resulting token stream
134
+ */
135
+ tokenize(text, lang, grammar = this.get_lang(lang)) {
136
+ return this.#tokenize_hooked(text, lang, grammar).tokens;
137
+ }
138
+ /**
139
+ * Runs `before_tokenize` → `tokenize_syntax` → `after_tokenize`, returning the
140
+ * resolved context. Shared by `stylize` (which also needs the post-hook `lang`)
141
+ * and `tokenize` (which only needs `tokens`).
142
+ */
143
+ #tokenize_hooked(text, lang, grammar) {
144
+ const ctx = {
115
145
  code: text,
116
146
  grammar,
117
147
  lang,
@@ -121,7 +151,7 @@ export class SyntaxStyler {
121
151
  const c = ctx;
122
152
  c.tokens = tokenize_syntax(c.code, c.grammar);
123
153
  this.run_hook_after_tokenize(c);
124
- return this.stringify_token(c.tokens, c.lang);
154
+ return c;
125
155
  }
126
156
  /**
127
157
  * Inserts tokens _before_ another token in a language definition or any other grammar.
@@ -140,7 +170,7 @@ export class SyntaxStyler {
140
170
  * };
141
171
  * ```
142
172
  *
143
- * then the `style` token will be added (and processed) at the end. `insert_before` allows you to insert tokens
173
+ * then the `style` token will be added (and processed) at the end. `grammar_insert_before` allows you to insert tokens
144
174
  * before existing tokens. For the CSS example above, you would use it like this:
145
175
  *
146
176
  * ```js
@@ -167,12 +197,12 @@ export class SyntaxStyler {
167
197
  *
168
198
  * ## Limitations
169
199
  *
170
- * The main problem `insert_before` has to solve is iteration order. Since ES2015, the iteration order for object
200
+ * The main problem `grammar_insert_before` has to solve is iteration order. Since ES2015, the iteration order for object
171
201
  * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
172
- * differently when keys are deleted and re-inserted. So `insert_before` can't be implemented by temporarily
202
+ * differently when keys are deleted and re-inserted. So `grammar_insert_before` can't be implemented by temporarily
173
203
  * deleting properties which is necessary to insert at arbitrary positions.
174
204
  *
175
- * To solve this problem, `insert_before` doesn't actually insert the given tokens into the target object.
205
+ * To solve this problem, `grammar_insert_before` doesn't actually insert the given tokens into the target object.
176
206
  * Instead, it will create a new object and replace all references to the target object with the new one. This
177
207
  * can be done without temporarily deleting properties, so the iteration order is well-defined.
178
208
  *
@@ -187,16 +217,13 @@ export class SyntaxStyler {
187
217
  * assert(newMarkup === syntax_styler.get_lang('markup'));
188
218
  * ```
189
219
  *
190
- * @param inside - The property of `root` (e.g. a language id in `syntax_styler.langs`) that contains the
191
- * object to be modified.
192
- * @param before - The key to insert before.
193
- * @param insert - An object containing the key-value pairs to be inserted.
194
- * @param root - The object containing `inside`, i.e. the object that contains the
195
- * object to be modified.
196
- *
197
- * Defaults to `syntax_styler.langs`.
198
- *
199
- * @returns the new grammar object
220
+ * @param inside - the property of `root` (e.g. a language id in `syntax_styler.langs`) that contains the
221
+ * object to be modified
222
+ * @param before - the key to insert before
223
+ * @param insert - an object containing the key-value pairs to be inserted
224
+ * @param root - the object containing `inside`, i.e. the object that contains the
225
+ * object to be modified; defaults to `syntax_styler.langs`
226
+ * @returns the new `SyntaxGrammar` object
200
227
  */
201
228
  grammar_insert_before(inside, before, insert, root = this.langs) {
202
229
  var grammar = root[inside];
@@ -231,16 +258,15 @@ export class SyntaxStyler {
231
258
  *
232
259
  * Runs the `wrap` hook on each `SyntaxToken`.
233
260
  *
234
- * @param o - The token or token stream to be converted.
235
- * @param lang - The name of current language.
236
- * @returns The HTML representation of the token or token stream.
261
+ * @param o - the token or `SyntaxTokenStream` to be converted
262
+ * @param lang - the name of current language
263
+ * @returns HTML representation of the token or token stream
237
264
  */
238
265
  stringify_token(o, lang) {
239
266
  if (typeof o === 'string') {
240
- return o
241
- .replace(/&/g, '&amp;')
242
- .replace(/</g, '&lt;')
243
- .replace(/\u00a0/g, ' ');
267
+ // single pass over the leaf text (only `&` and `<` need escaping in text
268
+ // content; `\u00a0` is normalized to a regular space)
269
+ return o.replace(/[&<\u00a0]/g, escape_text_char);
244
270
  }
245
271
  if (Array.isArray(o)) {
246
272
  var s = '';
@@ -249,19 +275,25 @@ export class SyntaxStyler {
249
275
  }
250
276
  return s;
251
277
  }
278
+ var content = this.stringify_token(o.content, lang);
279
+ // build the class list once; aliases are always an array after normalization
280
+ var classes = `token_${o.type}`;
281
+ for (const a of o.alias) {
282
+ classes += ` token_${a}`;
283
+ }
284
+ // fast path: with no `wrap` hooks the tag is always a plain <span> with no
285
+ // attributes, so skip the per-token context object and hook dispatch
286
+ if (this.hooks_wrap.length === 0) {
287
+ return '<span class="' + classes + '">' + content + '</span>';
288
+ }
252
289
  var ctx = {
253
290
  type: o.type,
254
- content: this.stringify_token(o.content, lang),
291
+ content,
255
292
  tag: 'span',
256
- classes: [`token_${o.type}`],
293
+ classes: classes.split(' '),
257
294
  attributes: {},
258
295
  lang,
259
296
  };
260
- var aliases = o.alias;
261
- // alias is always an array after normalization
262
- for (const a of aliases) {
263
- ctx.classes.push(`token_${a}`);
264
- }
265
297
  this.run_hook_wrap(ctx);
266
298
  var attributes = '';
267
299
  for (var name in ctx.attributes) {
@@ -294,9 +326,9 @@ export class SyntaxStyler {
294
326
  * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
295
327
  * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
296
328
  *
297
- * @param base_id - The id of the language to extend. This has to be a key in `syntax_styler.langs`.
298
- * @param extension - The new tokens to append.
299
- * @returns the new grammar
329
+ * @param base_id - the id of the language to extend, must be a key in `syntax_styler.langs`
330
+ * @param extension - the new tokens to append
331
+ * @returns the new `SyntaxGrammar`
300
332
  */
301
333
  extend_grammar(base_id, extension) {
302
334
  // Merge normalized base with un-normalized extension
@@ -307,7 +339,7 @@ export class SyntaxStyler {
307
339
  return extended;
308
340
  }
309
341
  /**
310
- * Normalize a single pattern to have consistent shape.
342
+ * Normalizes a single pattern to have consistent shape.
311
343
  * This ensures all patterns have the same object shape for V8 optimization.
312
344
  */
313
345
  #normalize_pattern(pattern, visited) {
@@ -339,15 +371,15 @@ export class SyntaxStyler {
339
371
  };
340
372
  }
341
373
  /**
342
- * Normalize a grammar to have consistent object shapes.
374
+ * Normalizes a grammar to have consistent object shapes.
343
375
  * This performs several optimizations:
344
- * 1. Merges `rest` property into main grammar
345
- * 2. Ensures all pattern values are arrays
346
- * 3. Normalizes all pattern objects to have consistent shapes
347
- * 4. Adds global flag to greedy patterns
376
+ * 1. Merges `rest` property into main grammar.
377
+ * 2. Ensures all pattern values are arrays.
378
+ * 3. Normalizes all pattern objects to have consistent shapes.
379
+ * 4. Adds global flag to greedy patterns.
348
380
  *
349
381
  * This is called once at registration time to avoid runtime overhead.
350
- * @param visited - Set of grammar object IDs already normalized (for circular references)
382
+ * @param visited - set of grammar object IDs already normalized (for circular references)
351
383
  */
352
384
  #normalize_grammar(grammar, visited) {
353
385
  // Check if we've already normalized this grammar (circular reference)
@@ -2,13 +2,13 @@ export declare class SyntaxToken {
2
2
  /**
3
3
  * The type of the token.
4
4
  *
5
- * This is usually the key of a pattern in a `Grammar`.
5
+ * This is usually the key of a pattern in a `SyntaxGrammar`.
6
6
  */
7
7
  type: string;
8
8
  /**
9
9
  * The strings or tokens contained by this token.
10
10
  *
11
- * This will be a token stream if the pattern matched also defined an `inside` grammar.
11
+ * This will be a `SyntaxTokenStream` if the pattern matched also defined an `inside` grammar.
12
12
  */
13
13
  content: string | SyntaxTokenStream;
14
14
  /**
@@ -22,8 +22,8 @@ export declare class SyntaxToken {
22
22
  /**
23
23
  * A token stream is an array of strings and `SyntaxToken` objects.
24
24
  *
25
- * Syntax token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
26
- * them.
25
+ * `SyntaxTokenStream` values have to fulfill a few properties that are assumed by most functions
26
+ * (mostly internal ones) that process them.
27
27
  *
28
28
  * 1. No adjacent strings.
29
29
  * 2. No empty strings.
@@ -2,13 +2,13 @@ export class SyntaxToken {
2
2
  /**
3
3
  * The type of the token.
4
4
  *
5
- * This is usually the key of a pattern in a `Grammar`.
5
+ * This is usually the key of a pattern in a `SyntaxGrammar`.
6
6
  */
7
7
  type;
8
8
  /**
9
9
  * The strings or tokens contained by this token.
10
10
  *
11
- * This will be a token stream if the pattern matched also defined an `inside` grammar.
11
+ * This will be a `SyntaxTokenStream` if the pattern matched also defined an `inside` grammar.
12
12
  */
13
13
  content;
14
14
  /**
@@ -9,11 +9,9 @@ import { type SyntaxTokenStream } from './syntax_token.js';
9
9
  * This method could be useful in other contexts as well, as a very crude parser.
10
10
  *
11
11
  * @param text - a string with the code to be styled
12
- * @param grammar - an object containing the tokens to use
13
- *
12
+ * @param grammar - a `SyntaxGrammar` object containing the tokens to use.
14
13
  * Usually a language definition like `syntax_styler.get_lang('markup')`.
15
- *
16
- * @returns an array of strings and tokens, a token stream
14
+ * @returns a `SyntaxTokenStream` array of strings and tokens
17
15
  *
18
16
  * @example
19
17
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"tokenize_syntax.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tokenize_syntax.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAc,KAAK,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,SAAS,aAAa,KAAG,iBAQtE,CAAC"}
1
+ {"version":3,"file":"tokenize_syntax.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/tokenize_syntax.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAc,KAAK,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,SAAS,aAAa,KAAG,iBAQtE,CAAC"}
@@ -8,11 +8,9 @@ import { SyntaxToken } from './syntax_token.js';
8
8
  * This method could be useful in other contexts as well, as a very crude parser.
9
9
  *
10
10
  * @param text - a string with the code to be styled
11
- * @param grammar - an object containing the tokens to use
12
- *
11
+ * @param grammar - a `SyntaxGrammar` object containing the tokens to use.
13
12
  * Usually a language definition like `syntax_styler.get_lang('markup')`.
14
- *
15
- * @returns an array of strings and tokens, a token stream
13
+ * @returns a `SyntaxTokenStream` array of strings and tokens
16
14
  *
17
15
  * @example
18
16
  * ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_code",
3
- "version": "0.45.1",
3
+ "version": "0.46.1",
4
4
  "description": "syntax styling utilities and components for TypeScript, Svelte, Markdown, and more",
5
5
  "glyph": "🎨",
6
6
  "logo": "logo.svg",
@@ -24,48 +24,46 @@
24
24
  "preview": "vite preview",
25
25
  "deploy": "gro deploy",
26
26
  "benchmark": "gro run benchmark/run_benchmarks.ts",
27
- "benchmark:compare": "gro run benchmark/compare/run_compare.ts",
27
+ "benchmark:save": "gro run benchmark/run_benchmarks.ts --save",
28
+ "benchmark:clean": "rm -f benchmark/baseline.json",
29
+ "benchmark:vs": "gro run benchmark/compare/run_compare.ts",
30
+ "benchmark:vs:write": "gro run benchmark/compare/run_compare.ts --write",
28
31
  "fixtures:update": "gro src/test/fixtures/update"
29
32
  },
30
33
  "type": "module",
31
34
  "engines": {
32
- "node": ">=22.15"
35
+ "node": ">=24.14"
33
36
  },
34
37
  "peerDependencies": {
35
- "@fuzdev/fuz_css": ">=0.47.0",
36
- "@fuzdev/fuz_util": ">=0.49.2",
38
+ "@fuzdev/fuz_css": ">=0.62.0",
39
+ "@fuzdev/fuz_util": ">=0.65.1",
37
40
  "esm-env": "^1",
38
- "magic-string": "^0.30",
39
- "svelte": "^5",
40
- "zimmerframe": "^1"
41
+ "svelte": "^5"
41
42
  },
42
43
  "peerDependenciesMeta": {
43
44
  "@fuzdev/fuz_css": {
44
45
  "optional": true
45
46
  },
46
- "@fuzdev/fuz_util": {
47
- "optional": true
48
- },
49
- "magic-string": {
50
- "optional": true
51
- },
52
47
  "svelte": {
53
48
  "optional": true
54
- },
55
- "zimmerframe": {
56
- "optional": true
57
49
  }
58
50
  },
51
+ "dependencies": {
52
+ "magic-string": "^0.30.21",
53
+ "zimmerframe": "^1.1.4"
54
+ },
59
55
  "devDependencies": {
60
56
  "@changesets/changelog-git": "^0.2.1",
61
- "@fuzdev/fuz_css": "^0.50.0",
62
- "@fuzdev/fuz_ui": "^0.183.1",
63
- "@fuzdev/fuz_util": "^0.51.0",
64
- "@fuzdev/gro": "^0.194.0",
65
- "@jridgewell/trace-mapping": "^0.3.31",
66
- "@ryanatkn/eslint-config": "^0.9.0",
57
+ "@fuzdev/blake3_wasm": "^0.1.1",
58
+ "@fuzdev/fuz_css": "^0.63.2",
59
+ "@fuzdev/fuz_ui": "^0.205.0",
60
+ "@fuzdev/fuz_util": "^0.65.1",
61
+ "@fuzdev/gro": "^0.204.0",
62
+ "@fuzdev/mdz": "^0.1.0",
63
+ "@ryanatkn/eslint-config": "^0.12.1",
64
+ "@sveltejs/acorn-typescript": "^1.0.9",
67
65
  "@sveltejs/adapter-static": "^3.0.10",
68
- "@sveltejs/kit": "^2.50.1",
66
+ "@sveltejs/kit": "^2.63.0",
69
67
  "@sveltejs/package": "^2.5.7",
70
68
  "@sveltejs/vite-plugin-svelte": "^6.2.4",
71
69
  "@types/estree": "^1.0.8",
@@ -74,17 +72,17 @@
74
72
  "eslint": "^9.39.1",
75
73
  "eslint-plugin-svelte": "^3.13.1",
76
74
  "esm-env": "^1.2.2",
77
- "magic-string": "^0.30.21",
78
75
  "prettier": "^3.7.4",
79
76
  "prettier-plugin-svelte": "^3.4.1",
80
- "svelte": "^5.49.1",
81
- "svelte-check": "^4.3.6",
82
- "svelte2tsx": "^0.7.47",
77
+ "svelte": "^5.56.2",
78
+ "svelte-check": "^4.6.0",
79
+ "svelte-docinfo": "^0.5.1",
80
+ "svelte2tsx": "^0.7.55",
83
81
  "tslib": "^2.8.1",
84
82
  "typescript": "^5.9.3",
85
83
  "typescript-eslint": "^8.48.1",
84
+ "vite": "^7.3.1",
86
85
  "vitest": "^4.0.15",
87
- "zimmerframe": "^1.1.4",
88
86
  "zod": "^4.3.6"
89
87
  },
90
88
  "prettier": {
@@ -16,7 +16,7 @@ interface FenceType {
16
16
  }
17
17
 
18
18
  /**
19
- * Helper to create fenced code block pattern for a language
19
+ * Helper to create fenced code block pattern for a language.
20
20
  */
21
21
  const create_fence_pattern = (
22
22
  backticks: string,
@@ -48,7 +48,7 @@ const create_fence_pattern = (
48
48
  };
49
49
 
50
50
  /**
51
- * Helper to create catch-all fence pattern (unknown languages)
51
+ * Helper to create catch-all fence pattern (unknown languages).
52
52
  */
53
53
  const create_catchall_fence = (backticks: string): SyntaxGrammarTokenRaw => {
54
54
  const pattern = new RegExp(`^${backticks}[^\\n\\r]*(?:\\r?\\n|\\r)[\\s\\S]*?^${backticks}$`, 'm');
@@ -67,7 +67,7 @@ const create_catchall_fence = (backticks: string): SyntaxGrammarTokenRaw => {
67
67
  };
68
68
 
69
69
  /**
70
- * Helper to create md self-reference placeholder pattern
70
+ * Helper to create md self-reference placeholder pattern.
71
71
  */
72
72
  const create_md_placeholder = (backticks: string): SyntaxGrammarTokenRaw => {
73
73
  const pattern = new RegExp(
@@ -98,9 +98,10 @@ export const add_grammar_markup: AddSyntaxGrammar = (syntax_styler) => {
98
98
  *
99
99
  * An example of an inlined language is CSS with `<style>` tags.
100
100
  *
101
- * @param tag_name - The name of the tag that contains the inlined language. This name will be treated as
102
- * case insensitive.
103
- * @param lang - The language key.
101
+ * @param syntax_styler - the `SyntaxStyler` instance to modify
102
+ * @param tag_name - the name of the tag that contains the inlined language, treated as case insensitive
103
+ * @param lang - the language key
104
+ * @param inside_lang - the language to insert into, defaults to `'markup'`
104
105
  */
105
106
  export const grammar_markup_add_inlined = (
106
107
  syntax_styler: SyntaxStyler,
@@ -145,13 +146,13 @@ export const grammar_markup_add_inlined = (
145
146
  };
146
147
 
147
148
  /**
148
- * Adds an pattern to style languages embedded in HTML attributes.
149
+ * Adds a pattern to style languages embedded in HTML attributes.
149
150
  *
150
151
  * An example of an inlined language is CSS with `style` attributes.
151
152
  *
152
- * @param attr_name - The name of the tag that contains the inlined language. This name will be treated as
153
- * case insensitive.
154
- * @param lang - The language key.
153
+ * @param syntax_styler - the `SyntaxStyler` instance to modify
154
+ * @param attr_name - the name of the attribute that contains the inlined language, treated as case insensitive
155
+ * @param lang - the language key
155
156
  */
156
157
  export const grammar_markup_add_attribute = (
157
158
  syntax_styler: SyntaxStyler,