@d10f/asciidoc-astro-loader 0.0.2 → 0.0.4

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.
@@ -43,73 +43,118 @@ declare const loaderOptionsSchema: z.ZodObject<{
43
43
  cssVariablePrefix: z.ZodDefault<z.ZodString>;
44
44
  mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
45
45
  tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
46
- transformers: z.ZodOptional<z.ZodArray<z.ZodObject<{
47
- name: z.ZodString;
48
- enforce: z.ZodUnion<[z.ZodLiteral<"pre">, z.ZodLiteral<"post">]>;
46
+ callouts: z.ZodOptional<z.ZodObject<{
47
+ cssClasses: z.ZodOptional<z.ZodString>;
49
48
  }, "strip", z.ZodTypeAny, {
50
- name: string;
51
- enforce: "pre" | "post";
49
+ cssClasses?: string | undefined;
52
50
  }, {
53
- name: string;
54
- enforce: "pre" | "post";
55
- }>, "many">>;
56
- }, "strip", z.ZodTypeAny, {
57
- theme: {
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">>]>, {
58
64
  light: string;
59
65
  dark: string;
60
66
  } & {
61
67
  [other: string]: string;
62
- };
63
- defaultColor: string;
64
- cssVariablePrefix: string;
65
- mergeWhitespaces: boolean | "never";
66
- tabindex: string | number | false;
67
- transformers?: {
68
- name: string;
69
- enforce: "pre" | "post";
70
- }[] | undefined;
71
- }, {
72
- theme?: string | z.objectInputType<{
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<{
73
91
  light: z.ZodString;
74
92
  dark: z.ZodString;
75
- }, z.ZodString, "strip"> | undefined;
76
- defaultColor?: string | undefined;
77
- cssVariablePrefix?: string | undefined;
78
- mergeWhitespaces?: boolean | "never" | undefined;
79
- tabindex?: string | number | false | undefined;
80
- transformers?: {
81
- name: string;
82
- enforce: "pre" | "post";
83
- }[] | undefined;
84
- }>, {
93
+ }, z.ZodString, "strip">>]>, {
94
+ light: string;
95
+ dark: string;
96
+ } & {
97
+ [other: string]: string;
98
+ }, string | z.objectInputType<{
99
+ light: z.ZodString;
100
+ dark: z.ZodString;
101
+ }, z.ZodString, "strip">>>;
102
+ defaultColor: z.ZodDefault<z.ZodString>;
103
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
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">>, {
85
114
  defaultColor: string;
86
115
  cssVariablePrefix: string;
87
116
  mergeWhitespaces: boolean | "never";
88
117
  tabindex: string | number | false;
89
- transformers?: {
90
- name: string;
91
- enforce: "pre" | "post";
92
- }[] | undefined;
118
+ callouts?: {
119
+ cssClasses?: string | undefined;
120
+ } | undefined;
93
121
  themes: {
94
122
  light: string;
95
123
  dark: string;
96
124
  } & {
97
125
  [other: string]: string;
98
126
  };
99
- }, {
100
- theme?: string | z.objectInputType<{
127
+ }, z.objectInputType<{
128
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
101
129
  light: z.ZodString;
102
130
  dark: z.ZodString;
103
- }, z.ZodString, "strip"> | undefined;
104
- defaultColor?: string | undefined;
105
- cssVariablePrefix?: string | undefined;
106
- mergeWhitespaces?: boolean | "never" | undefined;
107
- tabindex?: string | number | false | undefined;
108
- transformers?: {
109
- name: string;
110
- enforce: "pre" | "post";
111
- }[] | undefined;
112
- }>>;
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">>]>, {
138
+ light: string;
139
+ dark: string;
140
+ } & {
141
+ [other: string]: string;
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">>>;
113
158
  preamble: z.ZodDefault<z.ZodObject<{
114
159
  tableOfContents: z.ZodDefault<z.ZodBoolean>;
115
160
  maxLevel: z.ZodDefault<z.ZodNumber>;
@@ -137,10 +182,9 @@ declare const loaderOptionsSchema: z.ZodObject<{
137
182
  cssVariablePrefix: string;
138
183
  mergeWhitespaces: boolean | "never";
139
184
  tabindex: string | number | false;
140
- transformers?: {
141
- name: string;
142
- enforce: "pre" | "post";
143
- }[] | undefined;
185
+ callouts?: {
186
+ cssClasses?: string | undefined;
187
+ } | undefined;
144
188
  themes: {
145
189
  light: string;
146
190
  dark: string;
@@ -160,20 +204,37 @@ declare const loaderOptionsSchema: z.ZodObject<{
160
204
  template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
161
205
  recursive: z.ZodDefault<z.ZodBoolean>;
162
206
  }, z.ZodTypeAny, "passthrough"> | undefined;
163
- syntaxHighlighting?: {
164
- theme?: string | z.objectInputType<{
207
+ syntaxHighlighting?: z.objectInputType<{
208
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
165
209
  light: z.ZodString;
166
210
  dark: z.ZodString;
167
- }, z.ZodString, "strip"> | undefined;
168
- defaultColor?: string | undefined;
169
- cssVariablePrefix?: string | undefined;
170
- mergeWhitespaces?: boolean | "never" | undefined;
171
- tabindex?: string | number | false | undefined;
172
- transformers?: {
173
- name: string;
174
- enforce: "pre" | "post";
175
- }[] | undefined;
176
- } | undefined;
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;
177
238
  preamble?: {
178
239
  tableOfContents?: boolean | undefined;
179
240
  maxLevel?: number | undefined;
@@ -272,6 +333,22 @@ declare class TemplateEngineRegistry {
272
333
  private loadTemplates;
273
334
  }
274
335
 
336
+ /**
337
+ * Checks if the given property K is required in object T.
338
+ *
339
+ * @credit Chris Cook
340
+ * @see https://zirkelc.dev/posts/typescript-how-to-check-for-optional-properties
341
+ */
342
+ type IsRequired<T, K extends keyof T> = undefined extends T[K] ? object extends Pick<T, K> ? false : true : true;
343
+ /**
344
+ * Checks if any of the properties in T are required.
345
+ *
346
+ * @credit Chris Cook
347
+ * @see https://zirkelc.dev/posts/typescript-how-to-check-for-optional-properties
348
+ */
349
+ type HasRequiredKeys<T extends object> = keyof {
350
+ [K in keyof T as IsRequired<T, K> extends true ? K : never]: T[K];
351
+ } extends never ? false : true;
275
352
  type CustomConverter = {
276
353
  /**
277
354
  * The node context, or node type, that this converter will act upon.
@@ -292,8 +369,17 @@ type CustomConverter = {
292
369
  */
293
370
  convert(node: AbstractNode, templateEngine?: TemplateEngineRegistry): string | null | undefined;
294
371
  };
295
- type CustomConverterFactoryFn<T extends object | undefined> = (converterOptions: T) => CustomConverterFn;
372
+ type CustomConverterFactoryFn<T extends object> = HasRequiredKeys<T> extends true ? (converterOptions: T) => CustomConverterFn : (converterOptions?: T) => CustomConverterFn;
296
373
  type CustomConverterFn = (opts: RequiredOptions, highlighter: HighlighterCore) => CustomConverter;
374
+ type ShikiTransformerFactory<T extends object> = HasRequiredKeys<T> extends true ? (options: T) => ShikiTransformerFactoryFn : (options?: T) => ShikiTransformerFactoryFn;
375
+ type ShikiTransformerFactoryFn = (node: AbstractNode) => ShikiTransformer;
376
+ type CalloutOptions = Partial<{
377
+ /**
378
+ * CSS class to apply to Asciidoc callout elements. By default, styles
379
+ * are injected into the HTML element to make it unselectable.
380
+ */
381
+ cssClasses: string;
382
+ }>;
297
383
  type AsciidocLoader = {
298
384
  /**
299
385
  * Path to the Asciidoc documents to parse.
@@ -405,7 +491,14 @@ type AsciidocLoader = {
405
491
  *
406
492
  * @default [ transformerNotationDiff, transformerNotationHighlight, transformerNotationFocus ]
407
493
  */
408
- transformers: ShikiTransformer[];
494
+ transformers: Array<ShikiTransformer | ShikiTransformerFactoryFn>;
495
+ callouts: Partial<{
496
+ /**
497
+ * CSS class to apply to Asciidoc callout elements. By default, styles
498
+ * are injected into the HTML element to make it unselectable.
499
+ */
500
+ cssClasses: CalloutOptions['cssClasses'];
501
+ }>;
409
502
  }>;
410
503
  };
411
504
  /**
@@ -449,4 +542,4 @@ interface RawTemplate {
449
542
  renderString(content: string, options?: Record<string, unknown>): string;
450
543
  }
451
544
 
452
- 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 };
545
+ 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 };
@@ -43,73 +43,118 @@ declare const loaderOptionsSchema: z.ZodObject<{
43
43
  cssVariablePrefix: z.ZodDefault<z.ZodString>;
44
44
  mergeWhitespaces: z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"never">]>>;
45
45
  tabindex: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodLiteral<false>]>>;
46
- transformers: z.ZodOptional<z.ZodArray<z.ZodObject<{
47
- name: z.ZodString;
48
- enforce: z.ZodUnion<[z.ZodLiteral<"pre">, z.ZodLiteral<"post">]>;
46
+ callouts: z.ZodOptional<z.ZodObject<{
47
+ cssClasses: z.ZodOptional<z.ZodString>;
49
48
  }, "strip", z.ZodTypeAny, {
50
- name: string;
51
- enforce: "pre" | "post";
49
+ cssClasses?: string | undefined;
52
50
  }, {
53
- name: string;
54
- enforce: "pre" | "post";
55
- }>, "many">>;
56
- }, "strip", z.ZodTypeAny, {
57
- theme: {
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">>]>, {
58
64
  light: string;
59
65
  dark: string;
60
66
  } & {
61
67
  [other: string]: string;
62
- };
63
- defaultColor: string;
64
- cssVariablePrefix: string;
65
- mergeWhitespaces: boolean | "never";
66
- tabindex: string | number | false;
67
- transformers?: {
68
- name: string;
69
- enforce: "pre" | "post";
70
- }[] | undefined;
71
- }, {
72
- theme?: string | z.objectInputType<{
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<{
73
91
  light: z.ZodString;
74
92
  dark: z.ZodString;
75
- }, z.ZodString, "strip"> | undefined;
76
- defaultColor?: string | undefined;
77
- cssVariablePrefix?: string | undefined;
78
- mergeWhitespaces?: boolean | "never" | undefined;
79
- tabindex?: string | number | false | undefined;
80
- transformers?: {
81
- name: string;
82
- enforce: "pre" | "post";
83
- }[] | undefined;
84
- }>, {
93
+ }, z.ZodString, "strip">>]>, {
94
+ light: string;
95
+ dark: string;
96
+ } & {
97
+ [other: string]: string;
98
+ }, string | z.objectInputType<{
99
+ light: z.ZodString;
100
+ dark: z.ZodString;
101
+ }, z.ZodString, "strip">>>;
102
+ defaultColor: z.ZodDefault<z.ZodString>;
103
+ cssVariablePrefix: z.ZodDefault<z.ZodString>;
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">>, {
85
114
  defaultColor: string;
86
115
  cssVariablePrefix: string;
87
116
  mergeWhitespaces: boolean | "never";
88
117
  tabindex: string | number | false;
89
- transformers?: {
90
- name: string;
91
- enforce: "pre" | "post";
92
- }[] | undefined;
118
+ callouts?: {
119
+ cssClasses?: string | undefined;
120
+ } | undefined;
93
121
  themes: {
94
122
  light: string;
95
123
  dark: string;
96
124
  } & {
97
125
  [other: string]: string;
98
126
  };
99
- }, {
100
- theme?: string | z.objectInputType<{
127
+ }, z.objectInputType<{
128
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
101
129
  light: z.ZodString;
102
130
  dark: z.ZodString;
103
- }, z.ZodString, "strip"> | undefined;
104
- defaultColor?: string | undefined;
105
- cssVariablePrefix?: string | undefined;
106
- mergeWhitespaces?: boolean | "never" | undefined;
107
- tabindex?: string | number | false | undefined;
108
- transformers?: {
109
- name: string;
110
- enforce: "pre" | "post";
111
- }[] | undefined;
112
- }>>;
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">>]>, {
138
+ light: string;
139
+ dark: string;
140
+ } & {
141
+ [other: string]: string;
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">>>;
113
158
  preamble: z.ZodDefault<z.ZodObject<{
114
159
  tableOfContents: z.ZodDefault<z.ZodBoolean>;
115
160
  maxLevel: z.ZodDefault<z.ZodNumber>;
@@ -137,10 +182,9 @@ declare const loaderOptionsSchema: z.ZodObject<{
137
182
  cssVariablePrefix: string;
138
183
  mergeWhitespaces: boolean | "never";
139
184
  tabindex: string | number | false;
140
- transformers?: {
141
- name: string;
142
- enforce: "pre" | "post";
143
- }[] | undefined;
185
+ callouts?: {
186
+ cssClasses?: string | undefined;
187
+ } | undefined;
144
188
  themes: {
145
189
  light: string;
146
190
  dark: string;
@@ -160,20 +204,37 @@ declare const loaderOptionsSchema: z.ZodObject<{
160
204
  template: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
161
205
  recursive: z.ZodDefault<z.ZodBoolean>;
162
206
  }, z.ZodTypeAny, "passthrough"> | undefined;
163
- syntaxHighlighting?: {
164
- theme?: string | z.objectInputType<{
207
+ syntaxHighlighting?: z.objectInputType<{
208
+ theme: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodObject<{
165
209
  light: z.ZodString;
166
210
  dark: z.ZodString;
167
- }, z.ZodString, "strip"> | undefined;
168
- defaultColor?: string | undefined;
169
- cssVariablePrefix?: string | undefined;
170
- mergeWhitespaces?: boolean | "never" | undefined;
171
- tabindex?: string | number | false | undefined;
172
- transformers?: {
173
- name: string;
174
- enforce: "pre" | "post";
175
- }[] | undefined;
176
- } | undefined;
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;
177
238
  preamble?: {
178
239
  tableOfContents?: boolean | undefined;
179
240
  maxLevel?: number | undefined;
@@ -272,6 +333,22 @@ declare class TemplateEngineRegistry {
272
333
  private loadTemplates;
273
334
  }
274
335
 
336
+ /**
337
+ * Checks if the given property K is required in object T.
338
+ *
339
+ * @credit Chris Cook
340
+ * @see https://zirkelc.dev/posts/typescript-how-to-check-for-optional-properties
341
+ */
342
+ type IsRequired<T, K extends keyof T> = undefined extends T[K] ? object extends Pick<T, K> ? false : true : true;
343
+ /**
344
+ * Checks if any of the properties in T are required.
345
+ *
346
+ * @credit Chris Cook
347
+ * @see https://zirkelc.dev/posts/typescript-how-to-check-for-optional-properties
348
+ */
349
+ type HasRequiredKeys<T extends object> = keyof {
350
+ [K in keyof T as IsRequired<T, K> extends true ? K : never]: T[K];
351
+ } extends never ? false : true;
275
352
  type CustomConverter = {
276
353
  /**
277
354
  * The node context, or node type, that this converter will act upon.
@@ -292,8 +369,17 @@ type CustomConverter = {
292
369
  */
293
370
  convert(node: AbstractNode, templateEngine?: TemplateEngineRegistry): string | null | undefined;
294
371
  };
295
- type CustomConverterFactoryFn<T extends object | undefined> = (converterOptions: T) => CustomConverterFn;
372
+ type CustomConverterFactoryFn<T extends object> = HasRequiredKeys<T> extends true ? (converterOptions: T) => CustomConverterFn : (converterOptions?: T) => CustomConverterFn;
296
373
  type CustomConverterFn = (opts: RequiredOptions, highlighter: HighlighterCore) => CustomConverter;
374
+ type ShikiTransformerFactory<T extends object> = HasRequiredKeys<T> extends true ? (options: T) => ShikiTransformerFactoryFn : (options?: T) => ShikiTransformerFactoryFn;
375
+ type ShikiTransformerFactoryFn = (node: AbstractNode) => ShikiTransformer;
376
+ type CalloutOptions = Partial<{
377
+ /**
378
+ * CSS class to apply to Asciidoc callout elements. By default, styles
379
+ * are injected into the HTML element to make it unselectable.
380
+ */
381
+ cssClasses: string;
382
+ }>;
297
383
  type AsciidocLoader = {
298
384
  /**
299
385
  * Path to the Asciidoc documents to parse.
@@ -405,7 +491,14 @@ type AsciidocLoader = {
405
491
  *
406
492
  * @default [ transformerNotationDiff, transformerNotationHighlight, transformerNotationFocus ]
407
493
  */
408
- transformers: ShikiTransformer[];
494
+ transformers: Array<ShikiTransformer | ShikiTransformerFactoryFn>;
495
+ callouts: Partial<{
496
+ /**
497
+ * CSS class to apply to Asciidoc callout elements. By default, styles
498
+ * are injected into the HTML element to make it unselectable.
499
+ */
500
+ cssClasses: CalloutOptions['cssClasses'];
501
+ }>;
409
502
  }>;
410
503
  };
411
504
  /**
@@ -449,4 +542,4 @@ interface RawTemplate {
449
542
  renderString(content: string, options?: Record<string, unknown>): string;
450
543
  }
451
544
 
452
- 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 };
545
+ 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 };