@d10f/asciidoc-astro-loader 0.0.1 → 0.0.3

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.
@@ -1,6 +1,6 @@
1
- import { HighlighterCore, CodeToHastOptions, CodeOptionsMultipleThemes, ThemeRegistrationAny, StringLiteralUnion, BundledTheme } from 'shiki';
2
- import { AbstractNode } from 'asciidoctor';
3
- import { z } from 'zod';
1
+ import { HighlighterCore, CodeToHastOptions, CodeOptionsMultipleThemes, ThemeRegistrationAny, StringLiteralUnion, BundledTheme, ShikiTransformer } from 'shiki';
2
+ import { AbstractNode, AbstractBlock } from 'asciidoctor';
3
+ import { z } from 'astro/zod';
4
4
 
5
5
  type RequiredOptions = z.output<typeof loaderOptionsSchema>;
6
6
  type DocumentOptions = RequiredOptions['document'];
@@ -8,57 +8,239 @@ type PreambleOptions = RequiredOptions['preamble'];
8
8
  declare const loaderOptionsSchema: z.ZodObject<{
9
9
  base: z.ZodString;
10
10
  document: z.ZodDefault<z.ZodObject<{
11
- mode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
12
- template: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>;
11
+ mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
12
+ template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
13
13
  recursive: z.ZodDefault<z.ZodBoolean>;
14
- }, z.core.$loose>>;
15
- syntaxHighlighting: z.ZodDefault<z.ZodPipe<z.ZodObject<{
16
- theme: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
14
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
15
+ mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
16
+ template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
17
+ recursive: z.ZodDefault<z.ZodBoolean>;
18
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
19
+ mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
20
+ template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
21
+ recursive: z.ZodDefault<z.ZodBoolean>;
22
+ }, z.ZodTypeAny, "passthrough">>>;
23
+ syntaxHighlighting: z.ZodDefault<z.ZodEffects<z.ZodObject<{
24
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
25
+ light: z.ZodString;
26
+ dark: z.ZodString;
27
+ }, "strip", z.ZodString, z.objectOutputType<{
28
+ light: z.ZodString;
29
+ dark: z.ZodString;
30
+ }, z.ZodString, "strip">, z.objectInputType<{
17
31
  light: z.ZodString;
18
32
  dark: z.ZodString;
19
- }, z.core.$catchall<z.ZodString>>]>, z.ZodTransform<{
33
+ }, z.ZodString, "strip">>]>, {
20
34
  light: string;
21
35
  dark: string;
22
36
  } & {
23
37
  [other: string]: string;
24
- }, string | {
25
- [x: string]: string;
38
+ }, string | z.objectInputType<{
39
+ light: z.ZodString;
40
+ dark: z.ZodString;
41
+ }, z.ZodString, "strip">>>;
42
+ defaultColor: z.ZodDefault<z.ZodString>;
43
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
44
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
45
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
46
+ callouts: z.ZodOptional<z.ZodObject<{
47
+ cssClasses: z.ZodOptional<z.ZodString>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ cssClasses?: string | undefined;
50
+ }, {
51
+ cssClasses?: string | undefined;
52
+ }>>;
53
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
54
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
55
+ light: z.ZodString;
56
+ dark: z.ZodString;
57
+ }, "strip", z.ZodString, z.objectOutputType<{
58
+ light: z.ZodString;
59
+ dark: z.ZodString;
60
+ }, z.ZodString, "strip">, z.objectInputType<{
61
+ light: z.ZodString;
62
+ dark: z.ZodString;
63
+ }, z.ZodString, "strip">>]>, {
64
+ light: string;
65
+ dark: string;
66
+ } & {
67
+ [other: string]: string;
68
+ }, string | z.objectInputType<{
69
+ light: z.ZodString;
70
+ dark: z.ZodString;
71
+ }, z.ZodString, "strip">>>;
72
+ defaultColor: z.ZodDefault<z.ZodString>;
73
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
74
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
75
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
76
+ callouts: z.ZodOptional<z.ZodObject<{
77
+ cssClasses: z.ZodOptional<z.ZodString>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ cssClasses?: string | undefined;
80
+ }, {
81
+ cssClasses?: string | undefined;
82
+ }>>;
83
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
84
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
85
+ light: z.ZodString;
86
+ dark: z.ZodString;
87
+ }, "strip", z.ZodString, z.objectOutputType<{
88
+ light: z.ZodString;
89
+ dark: z.ZodString;
90
+ }, z.ZodString, "strip">, z.objectInputType<{
91
+ light: z.ZodString;
92
+ dark: z.ZodString;
93
+ }, z.ZodString, "strip">>]>, {
26
94
  light: string;
27
95
  dark: string;
28
- }>>>;
96
+ } & {
97
+ [other: string]: string;
98
+ }, string | z.objectInputType<{
99
+ light: z.ZodString;
100
+ dark: z.ZodString;
101
+ }, z.ZodString, "strip">>>;
29
102
  defaultColor: z.ZodDefault<z.ZodString>;
30
103
  cssVariablePrefix: z.ZodDefault<z.ZodString>;
31
- mergeWhitespaces: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"never">]>>;
32
- tabindex: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
33
- }, z.core.$strip>, z.ZodTransform<{
104
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
105
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
106
+ callouts: z.ZodOptional<z.ZodObject<{
107
+ cssClasses: z.ZodOptional<z.ZodString>;
108
+ }, "strip", z.ZodTypeAny, {
109
+ cssClasses?: string | undefined;
110
+ }, {
111
+ cssClasses?: string | undefined;
112
+ }>>;
113
+ }, z.ZodTypeAny, "passthrough">>, {
34
114
  defaultColor: string;
35
115
  cssVariablePrefix: string;
36
116
  mergeWhitespaces: boolean | "never";
37
117
  tabindex: string | number | false;
118
+ callouts?: {
119
+ cssClasses?: string | undefined;
120
+ } | undefined;
38
121
  themes: {
39
122
  light: string;
40
123
  dark: string;
41
124
  } & {
42
125
  [other: string]: string;
43
126
  };
44
- }, {
45
- theme: {
127
+ }, z.objectInputType<{
128
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
129
+ light: z.ZodString;
130
+ dark: z.ZodString;
131
+ }, "strip", z.ZodString, z.objectOutputType<{
132
+ light: z.ZodString;
133
+ dark: z.ZodString;
134
+ }, z.ZodString, "strip">, z.objectInputType<{
135
+ light: z.ZodString;
136
+ dark: z.ZodString;
137
+ }, z.ZodString, "strip">>]>, {
46
138
  light: string;
47
139
  dark: string;
48
140
  } & {
49
141
  [other: string]: string;
50
- };
142
+ }, string | z.objectInputType<{
143
+ light: z.ZodString;
144
+ dark: z.ZodString;
145
+ }, z.ZodString, "strip">>>;
146
+ defaultColor: z.ZodDefault<z.ZodString>;
147
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
148
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
149
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
150
+ callouts: z.ZodOptional<z.ZodObject<{
151
+ cssClasses: z.ZodOptional<z.ZodString>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ cssClasses?: string | undefined;
154
+ }, {
155
+ cssClasses?: string | undefined;
156
+ }>>;
157
+ }, z.ZodTypeAny, "passthrough">>>;
158
+ preamble: z.ZodDefault<z.ZodObject<{
159
+ tableOfContents: z.ZodDefault<z.ZodBoolean>;
160
+ maxLevel: z.ZodDefault<z.ZodNumber>;
161
+ position: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"before">, z.ZodLiteral<"after">]>>;
162
+ }, "strip", z.ZodTypeAny, {
163
+ tableOfContents: boolean;
164
+ maxLevel: number;
165
+ position: "before" | "after";
166
+ }, {
167
+ tableOfContents?: boolean | undefined;
168
+ maxLevel?: number | undefined;
169
+ position?: "before" | "after" | undefined;
170
+ }>>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ base: string;
173
+ document: {
174
+ mode: "safe" | "unsafe";
175
+ template: string;
176
+ recursive: boolean;
177
+ } & {
178
+ [k: string]: unknown;
179
+ };
180
+ syntaxHighlighting: {
51
181
  defaultColor: string;
52
182
  cssVariablePrefix: string;
53
183
  mergeWhitespaces: boolean | "never";
54
184
  tabindex: string | number | false;
55
- }>>>;
56
- preamble: z.ZodDefault<z.ZodObject<{
57
- tableOfContents: z.ZodDefault<z.ZodBoolean>;
58
- maxLevel: z.ZodDefault<z.ZodNumber>;
59
- position: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"before">, z.ZodLiteral<"after">]>>;
60
- }, z.core.$strip>>;
61
- }, z.core.$strip>;
185
+ callouts?: {
186
+ cssClasses?: string | undefined;
187
+ } | undefined;
188
+ themes: {
189
+ light: string;
190
+ dark: string;
191
+ } & {
192
+ [other: string]: string;
193
+ };
194
+ };
195
+ preamble: {
196
+ tableOfContents: boolean;
197
+ maxLevel: number;
198
+ position: "before" | "after";
199
+ };
200
+ }, {
201
+ base: string;
202
+ document?: z.objectInputType<{
203
+ mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
204
+ template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
205
+ recursive: z.ZodDefault<z.ZodBoolean>;
206
+ }, z.ZodTypeAny, "passthrough"> | undefined;
207
+ syntaxHighlighting?: z.objectInputType<{
208
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
209
+ light: z.ZodString;
210
+ dark: z.ZodString;
211
+ }, "strip", z.ZodString, z.objectOutputType<{
212
+ light: z.ZodString;
213
+ dark: z.ZodString;
214
+ }, z.ZodString, "strip">, z.objectInputType<{
215
+ light: z.ZodString;
216
+ dark: z.ZodString;
217
+ }, z.ZodString, "strip">>]>, {
218
+ light: string;
219
+ dark: string;
220
+ } & {
221
+ [other: string]: string;
222
+ }, string | z.objectInputType<{
223
+ light: z.ZodString;
224
+ dark: z.ZodString;
225
+ }, z.ZodString, "strip">>>;
226
+ defaultColor: z.ZodDefault<z.ZodString>;
227
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
228
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
229
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
230
+ callouts: z.ZodOptional<z.ZodObject<{
231
+ cssClasses: z.ZodOptional<z.ZodString>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ cssClasses?: string | undefined;
234
+ }, {
235
+ cssClasses?: string | undefined;
236
+ }>>;
237
+ }, z.ZodTypeAny, "passthrough"> | undefined;
238
+ preamble?: {
239
+ tableOfContents?: boolean | undefined;
240
+ maxLevel?: number | undefined;
241
+ position?: "before" | "after" | undefined;
242
+ } | undefined;
243
+ }>;
62
244
 
63
245
  declare abstract class AbstractEngine {
64
246
  private _name;
@@ -141,7 +323,7 @@ declare class TemplateEngineRegistry {
141
323
  * engine itself with _getEngineByName_ or _getEngineByExtension_
142
324
  * and use one of its render methods directly.
143
325
  */
144
- convert(node: AbstractNode, options?: Record<string, unknown>): string | undefined;
326
+ convert(node: AbstractBlock, options?: Record<string, unknown>): string | undefined;
145
327
  /**
146
328
  * Scans the templates directory and creates an index of all templates
147
329
  * based on supported block names and extensions.
@@ -173,6 +355,15 @@ type CustomConverter = {
173
355
  };
174
356
  type CustomConverterFactoryFn<T extends object | undefined> = (converterOptions: T) => CustomConverterFn;
175
357
  type CustomConverterFn = (opts: RequiredOptions, highlighter: HighlighterCore) => CustomConverter;
358
+ type ShikiTransformerFactory<T extends object> = (options?: T) => ShikiTransformerFactoryFn;
359
+ type ShikiTransformerFactoryFn = (node: AbstractNode) => ShikiTransformer;
360
+ type CalloutOptions = Partial<{
361
+ /**
362
+ * CSS class to apply to Asciidoc callout elements. By default, styles
363
+ * are injected into the HTML element to make it unselectable.
364
+ */
365
+ cssClasses: string;
366
+ }>;
176
367
  type AsciidocLoader = {
177
368
  /**
178
369
  * Path to the Asciidoc documents to parse.
@@ -279,6 +470,19 @@ type AsciidocLoader = {
279
470
  dark: BundledTheme;
280
471
  [customTheme: string]: BundledTheme;
281
472
  };
473
+ /**
474
+ * A list of transformers to apply for source code blocks.
475
+ *
476
+ * @default [ transformerNotationDiff, transformerNotationHighlight, transformerNotationFocus ]
477
+ */
478
+ transformers: Array<ShikiTransformer | ShikiTransformerFactoryFn>;
479
+ callouts: Partial<{
480
+ /**
481
+ * CSS class to apply to Asciidoc callout elements. By default, styles
482
+ * are injected into the HTML element to make it unselectable.
483
+ */
484
+ cssClasses: CalloutOptions['cssClasses'];
485
+ }>;
282
486
  }>;
283
487
  };
284
488
  /**
@@ -305,7 +509,7 @@ interface TemplateModule {
305
509
  * to the template rendering process.
306
510
  */
307
511
  interface AsciidocTemplate {
308
- renderNode(node: AbstractNode, options?: Record<string, unknown>): string;
512
+ renderNode(node: AbstractBlock, options?: Record<string, unknown>): string;
309
513
  }
310
514
  /**
311
515
  * Designates that the template will receive a file location that points
@@ -322,4 +526,4 @@ interface RawTemplate {
322
526
  renderString(content: string, options?: Record<string, unknown>): string;
323
527
  }
324
528
 
325
- export { type AsciidocLoader as A, type CustomConverterFactoryFn as C, type FilesystemTemplate as F, type NodeContext as N, type RawTemplate as R, type TemplateModule as T, type AsciidocTemplate as a, AbstractEngine as b };
529
+ export { type AsciidocLoader as A, type CustomConverterFactoryFn as C, type FilesystemTemplate as F, type NodeContext as N, type RawTemplate as R, type ShikiTransformerFactoryFn as S, type TemplateModule as T, type AsciidocTemplate as a, type ShikiTransformerFactory as b, AbstractEngine as c };
@@ -1,6 +1,6 @@
1
- import { HighlighterCore, CodeToHastOptions, CodeOptionsMultipleThemes, ThemeRegistrationAny, StringLiteralUnion, BundledTheme } from 'shiki';
2
- import { AbstractNode } from 'asciidoctor';
3
- import { z } from 'zod';
1
+ import { HighlighterCore, CodeToHastOptions, CodeOptionsMultipleThemes, ThemeRegistrationAny, StringLiteralUnion, BundledTheme, ShikiTransformer } from 'shiki';
2
+ import { AbstractNode, AbstractBlock } from 'asciidoctor';
3
+ import { z } from 'astro/zod';
4
4
 
5
5
  type RequiredOptions = z.output<typeof loaderOptionsSchema>;
6
6
  type DocumentOptions = RequiredOptions['document'];
@@ -8,57 +8,239 @@ type PreambleOptions = RequiredOptions['preamble'];
8
8
  declare const loaderOptionsSchema: z.ZodObject<{
9
9
  base: z.ZodString;
10
10
  document: z.ZodDefault<z.ZodObject<{
11
- mode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
12
- template: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string, string>>;
11
+ mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
12
+ template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
13
13
  recursive: z.ZodDefault<z.ZodBoolean>;
14
- }, z.core.$loose>>;
15
- syntaxHighlighting: z.ZodDefault<z.ZodPipe<z.ZodObject<{
16
- theme: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
14
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
15
+ mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
16
+ template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
17
+ recursive: z.ZodDefault<z.ZodBoolean>;
18
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
19
+ mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
20
+ template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
21
+ recursive: z.ZodDefault<z.ZodBoolean>;
22
+ }, z.ZodTypeAny, "passthrough">>>;
23
+ syntaxHighlighting: z.ZodDefault<z.ZodEffects<z.ZodObject<{
24
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
25
+ light: z.ZodString;
26
+ dark: z.ZodString;
27
+ }, "strip", z.ZodString, z.objectOutputType<{
28
+ light: z.ZodString;
29
+ dark: z.ZodString;
30
+ }, z.ZodString, "strip">, z.objectInputType<{
17
31
  light: z.ZodString;
18
32
  dark: z.ZodString;
19
- }, z.core.$catchall<z.ZodString>>]>, z.ZodTransform<{
33
+ }, z.ZodString, "strip">>]>, {
20
34
  light: string;
21
35
  dark: string;
22
36
  } & {
23
37
  [other: string]: string;
24
- }, string | {
25
- [x: string]: string;
38
+ }, string | z.objectInputType<{
39
+ light: z.ZodString;
40
+ dark: z.ZodString;
41
+ }, z.ZodString, "strip">>>;
42
+ defaultColor: z.ZodDefault<z.ZodString>;
43
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
44
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
45
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
46
+ callouts: z.ZodOptional<z.ZodObject<{
47
+ cssClasses: z.ZodOptional<z.ZodString>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ cssClasses?: string | undefined;
50
+ }, {
51
+ cssClasses?: string | undefined;
52
+ }>>;
53
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
54
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
55
+ light: z.ZodString;
56
+ dark: z.ZodString;
57
+ }, "strip", z.ZodString, z.objectOutputType<{
58
+ light: z.ZodString;
59
+ dark: z.ZodString;
60
+ }, z.ZodString, "strip">, z.objectInputType<{
61
+ light: z.ZodString;
62
+ dark: z.ZodString;
63
+ }, z.ZodString, "strip">>]>, {
64
+ light: string;
65
+ dark: string;
66
+ } & {
67
+ [other: string]: string;
68
+ }, string | z.objectInputType<{
69
+ light: z.ZodString;
70
+ dark: z.ZodString;
71
+ }, z.ZodString, "strip">>>;
72
+ defaultColor: z.ZodDefault<z.ZodString>;
73
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
74
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
75
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
76
+ callouts: z.ZodOptional<z.ZodObject<{
77
+ cssClasses: z.ZodOptional<z.ZodString>;
78
+ }, "strip", z.ZodTypeAny, {
79
+ cssClasses?: string | undefined;
80
+ }, {
81
+ cssClasses?: string | undefined;
82
+ }>>;
83
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
84
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
85
+ light: z.ZodString;
86
+ dark: z.ZodString;
87
+ }, "strip", z.ZodString, z.objectOutputType<{
88
+ light: z.ZodString;
89
+ dark: z.ZodString;
90
+ }, z.ZodString, "strip">, z.objectInputType<{
91
+ light: z.ZodString;
92
+ dark: z.ZodString;
93
+ }, z.ZodString, "strip">>]>, {
26
94
  light: string;
27
95
  dark: string;
28
- }>>>;
96
+ } & {
97
+ [other: string]: string;
98
+ }, string | z.objectInputType<{
99
+ light: z.ZodString;
100
+ dark: z.ZodString;
101
+ }, z.ZodString, "strip">>>;
29
102
  defaultColor: z.ZodDefault<z.ZodString>;
30
103
  cssVariablePrefix: z.ZodDefault<z.ZodString>;
31
- mergeWhitespaces: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"never">]>>;
32
- tabindex: z.ZodDefault<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
33
- }, z.core.$strip>, z.ZodTransform<{
104
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
105
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
106
+ callouts: z.ZodOptional<z.ZodObject<{
107
+ cssClasses: z.ZodOptional<z.ZodString>;
108
+ }, "strip", z.ZodTypeAny, {
109
+ cssClasses?: string | undefined;
110
+ }, {
111
+ cssClasses?: string | undefined;
112
+ }>>;
113
+ }, z.ZodTypeAny, "passthrough">>, {
34
114
  defaultColor: string;
35
115
  cssVariablePrefix: string;
36
116
  mergeWhitespaces: boolean | "never";
37
117
  tabindex: string | number | false;
118
+ callouts?: {
119
+ cssClasses?: string | undefined;
120
+ } | undefined;
38
121
  themes: {
39
122
  light: string;
40
123
  dark: string;
41
124
  } & {
42
125
  [other: string]: string;
43
126
  };
44
- }, {
45
- theme: {
127
+ }, z.objectInputType<{
128
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
129
+ light: z.ZodString;
130
+ dark: z.ZodString;
131
+ }, "strip", z.ZodString, z.objectOutputType<{
132
+ light: z.ZodString;
133
+ dark: z.ZodString;
134
+ }, z.ZodString, "strip">, z.objectInputType<{
135
+ light: z.ZodString;
136
+ dark: z.ZodString;
137
+ }, z.ZodString, "strip">>]>, {
46
138
  light: string;
47
139
  dark: string;
48
140
  } & {
49
141
  [other: string]: string;
50
- };
142
+ }, string | z.objectInputType<{
143
+ light: z.ZodString;
144
+ dark: z.ZodString;
145
+ }, z.ZodString, "strip">>>;
146
+ defaultColor: z.ZodDefault<z.ZodString>;
147
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
148
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
149
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
150
+ callouts: z.ZodOptional<z.ZodObject<{
151
+ cssClasses: z.ZodOptional<z.ZodString>;
152
+ }, "strip", z.ZodTypeAny, {
153
+ cssClasses?: string | undefined;
154
+ }, {
155
+ cssClasses?: string | undefined;
156
+ }>>;
157
+ }, z.ZodTypeAny, "passthrough">>>;
158
+ preamble: z.ZodDefault<z.ZodObject<{
159
+ tableOfContents: z.ZodDefault<z.ZodBoolean>;
160
+ maxLevel: z.ZodDefault<z.ZodNumber>;
161
+ position: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"before">, z.ZodLiteral<"after">]>>;
162
+ }, "strip", z.ZodTypeAny, {
163
+ tableOfContents: boolean;
164
+ maxLevel: number;
165
+ position: "before" | "after";
166
+ }, {
167
+ tableOfContents?: boolean | undefined;
168
+ maxLevel?: number | undefined;
169
+ position?: "before" | "after" | undefined;
170
+ }>>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ base: string;
173
+ document: {
174
+ mode: "safe" | "unsafe";
175
+ template: string;
176
+ recursive: boolean;
177
+ } & {
178
+ [k: string]: unknown;
179
+ };
180
+ syntaxHighlighting: {
51
181
  defaultColor: string;
52
182
  cssVariablePrefix: string;
53
183
  mergeWhitespaces: boolean | "never";
54
184
  tabindex: string | number | false;
55
- }>>>;
56
- preamble: z.ZodDefault<z.ZodObject<{
57
- tableOfContents: z.ZodDefault<z.ZodBoolean>;
58
- maxLevel: z.ZodDefault<z.ZodNumber>;
59
- position: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"before">, z.ZodLiteral<"after">]>>;
60
- }, z.core.$strip>>;
61
- }, z.core.$strip>;
185
+ callouts?: {
186
+ cssClasses?: string | undefined;
187
+ } | undefined;
188
+ themes: {
189
+ light: string;
190
+ dark: string;
191
+ } & {
192
+ [other: string]: string;
193
+ };
194
+ };
195
+ preamble: {
196
+ tableOfContents: boolean;
197
+ maxLevel: number;
198
+ position: "before" | "after";
199
+ };
200
+ }, {
201
+ base: string;
202
+ document?: z.objectInputType<{
203
+ mode: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"safe">, z.ZodLiteral<"unsafe">]>>;
204
+ template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
205
+ recursive: z.ZodDefault<z.ZodBoolean>;
206
+ }, z.ZodTypeAny, "passthrough"> | undefined;
207
+ syntaxHighlighting?: z.objectInputType<{
208
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
209
+ light: z.ZodString;
210
+ dark: z.ZodString;
211
+ }, "strip", z.ZodString, z.objectOutputType<{
212
+ light: z.ZodString;
213
+ dark: z.ZodString;
214
+ }, z.ZodString, "strip">, z.objectInputType<{
215
+ light: z.ZodString;
216
+ dark: z.ZodString;
217
+ }, z.ZodString, "strip">>]>, {
218
+ light: string;
219
+ dark: string;
220
+ } & {
221
+ [other: string]: string;
222
+ }, string | z.objectInputType<{
223
+ light: z.ZodString;
224
+ dark: z.ZodString;
225
+ }, z.ZodString, "strip">>>;
226
+ defaultColor: z.ZodDefault<z.ZodString>;
227
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
228
+ mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
229
+ tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
230
+ callouts: z.ZodOptional<z.ZodObject<{
231
+ cssClasses: z.ZodOptional<z.ZodString>;
232
+ }, "strip", z.ZodTypeAny, {
233
+ cssClasses?: string | undefined;
234
+ }, {
235
+ cssClasses?: string | undefined;
236
+ }>>;
237
+ }, z.ZodTypeAny, "passthrough"> | undefined;
238
+ preamble?: {
239
+ tableOfContents?: boolean | undefined;
240
+ maxLevel?: number | undefined;
241
+ position?: "before" | "after" | undefined;
242
+ } | undefined;
243
+ }>;
62
244
 
63
245
  declare abstract class AbstractEngine {
64
246
  private _name;
@@ -141,7 +323,7 @@ declare class TemplateEngineRegistry {
141
323
  * engine itself with _getEngineByName_ or _getEngineByExtension_
142
324
  * and use one of its render methods directly.
143
325
  */
144
- convert(node: AbstractNode, options?: Record<string, unknown>): string | undefined;
326
+ convert(node: AbstractBlock, options?: Record<string, unknown>): string | undefined;
145
327
  /**
146
328
  * Scans the templates directory and creates an index of all templates
147
329
  * based on supported block names and extensions.
@@ -173,6 +355,15 @@ type CustomConverter = {
173
355
  };
174
356
  type CustomConverterFactoryFn<T extends object | undefined> = (converterOptions: T) => CustomConverterFn;
175
357
  type CustomConverterFn = (opts: RequiredOptions, highlighter: HighlighterCore) => CustomConverter;
358
+ type ShikiTransformerFactory<T extends object> = (options?: T) => ShikiTransformerFactoryFn;
359
+ type ShikiTransformerFactoryFn = (node: AbstractNode) => ShikiTransformer;
360
+ type CalloutOptions = Partial<{
361
+ /**
362
+ * CSS class to apply to Asciidoc callout elements. By default, styles
363
+ * are injected into the HTML element to make it unselectable.
364
+ */
365
+ cssClasses: string;
366
+ }>;
176
367
  type AsciidocLoader = {
177
368
  /**
178
369
  * Path to the Asciidoc documents to parse.
@@ -279,6 +470,19 @@ type AsciidocLoader = {
279
470
  dark: BundledTheme;
280
471
  [customTheme: string]: BundledTheme;
281
472
  };
473
+ /**
474
+ * A list of transformers to apply for source code blocks.
475
+ *
476
+ * @default [ transformerNotationDiff, transformerNotationHighlight, transformerNotationFocus ]
477
+ */
478
+ transformers: Array<ShikiTransformer | ShikiTransformerFactoryFn>;
479
+ callouts: Partial<{
480
+ /**
481
+ * CSS class to apply to Asciidoc callout elements. By default, styles
482
+ * are injected into the HTML element to make it unselectable.
483
+ */
484
+ cssClasses: CalloutOptions['cssClasses'];
485
+ }>;
282
486
  }>;
283
487
  };
284
488
  /**
@@ -305,7 +509,7 @@ interface TemplateModule {
305
509
  * to the template rendering process.
306
510
  */
307
511
  interface AsciidocTemplate {
308
- renderNode(node: AbstractNode, options?: Record<string, unknown>): string;
512
+ renderNode(node: AbstractBlock, options?: Record<string, unknown>): string;
309
513
  }
310
514
  /**
311
515
  * Designates that the template will receive a file location that points
@@ -322,4 +526,4 @@ interface RawTemplate {
322
526
  renderString(content: string, options?: Record<string, unknown>): string;
323
527
  }
324
528
 
325
- export { type AsciidocLoader as A, type CustomConverterFactoryFn as C, type FilesystemTemplate as F, type NodeContext as N, type RawTemplate as R, type TemplateModule as T, type AsciidocTemplate as a, AbstractEngine as b };
529
+ export { type AsciidocLoader as A, type CustomConverterFactoryFn as C, type FilesystemTemplate as F, type NodeContext as N, type RawTemplate as R, type ShikiTransformerFactoryFn as S, type TemplateModule as T, type AsciidocTemplate as a, type ShikiTransformerFactory as b, AbstractEngine as c };