@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.
- package/README.md +153 -95
- package/dist/chunk-2UGTFP4R.js +22 -0
- package/dist/chunk-5P6LDJGO.js +65 -0
- package/dist/{chunk-BRMWIQA2.js → chunk-NC6IZHLR.js} +8 -10
- package/dist/{index-BNxO58s3.d.cts → index-CS3PBqxf.d.cts} +159 -66
- package/dist/{index-BNxO58s3.d.ts → index-CS3PBqxf.d.ts} +159 -66
- package/dist/index.cjs +227 -254
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +47 -37
- package/dist/lib/asciidoc/converters/index.cjs +6 -100
- package/dist/lib/asciidoc/converters/index.d.cts +5 -5
- package/dist/lib/asciidoc/converters/index.d.ts +5 -5
- package/dist/lib/asciidoc/converters/index.js +2 -2
- package/dist/lib/asciidoc/templates/engines/index.d.cts +1 -1
- package/dist/lib/asciidoc/templates/engines/index.d.ts +1 -1
- package/dist/lib/shiki/transformers/index.cjs +120 -79
- package/dist/lib/shiki/transformers/index.d.cts +52 -32
- package/dist/lib/shiki/transformers/index.d.ts +52 -32
- package/dist/lib/shiki/transformers/index.js +76 -4
- package/package.json +1 -1
- package/dist/chunk-DDIUST2Z.js +0 -113
|
@@ -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
|
-
|
|
47
|
-
|
|
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
|
-
|
|
51
|
-
enforce: "pre" | "post";
|
|
49
|
+
cssClasses?: string | undefined;
|
|
52
50
|
}, {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
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,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
|
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,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
|
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,
|
|
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
|
-
|
|
47
|
-
|
|
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
|
-
|
|
51
|
-
enforce: "pre" | "post";
|
|
49
|
+
cssClasses?: string | undefined;
|
|
52
50
|
}, {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
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,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
|
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,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
|
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,
|
|
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 };
|