@d10f/asciidoc-astro-loader 0.0.8 → 0.0.10
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/dist/{chunk-NC6IZHLR.js → chunk-SUQERYPQ.js} +12 -11
- package/dist/{index-PY1MiQbP.d.cts → index-C8nJcG2h.d.cts} +6 -2
- package/dist/{index-PY1MiQbP.d.ts → index-C8nJcG2h.d.ts} +6 -2
- package/dist/index.cjs +22 -11
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -1
- package/dist/lib/asciidoc/converters/index.cjs +12 -11
- package/dist/lib/asciidoc/converters/index.d.cts +1 -1
- package/dist/lib/asciidoc/converters/index.d.ts +1 -1
- package/dist/lib/asciidoc/converters/index.js +1 -1
- 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.d.cts +31 -4
- package/dist/lib/shiki/transformers/index.d.ts +31 -4
- package/package.json +2 -2
- package/dist/transformerPrompt-DfCRhAD2.d.ts +0 -32
- package/dist/transformerPrompt-n_gHpQ3r.d.cts +0 -32
|
@@ -21,19 +21,20 @@ var sourceCodeConverter = (converterOptions) => {
|
|
|
21
21
|
return typeof transformer === "function" ? transformer(node) : transformer;
|
|
22
22
|
})
|
|
23
23
|
});
|
|
24
|
-
if (templateEngine
|
|
25
|
-
const { extension } = splitFilenameComponents(
|
|
26
|
-
|
|
27
|
-
extension || ""
|
|
24
|
+
if (templateEngine) {
|
|
25
|
+
const { extension } = splitFilenameComponents(
|
|
26
|
+
template ?? ""
|
|
28
27
|
);
|
|
29
|
-
|
|
28
|
+
const engine = extension ? templateEngine.getEngineByExtension(extension ?? "") : templateEngine.getEngineByContext(this.nodeContext);
|
|
29
|
+
if (template) {
|
|
30
30
|
const templateFile = resolve(process.cwd(), template);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
engine?.addContext(this.nodeContext, templateFile);
|
|
32
|
+
}
|
|
33
|
+
if (engine) {
|
|
34
|
+
return engine.renderNode(node, {
|
|
35
|
+
content: output,
|
|
36
|
+
lang
|
|
37
|
+
});
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
return output;
|
|
@@ -317,6 +317,10 @@ declare class TemplateEngineRegistry {
|
|
|
317
317
|
* Returns the module that supports the given extension.
|
|
318
318
|
*/
|
|
319
319
|
getEngineByExtension(ext: string): (AbstractEngine & AsciidocTemplate) | undefined;
|
|
320
|
+
/**
|
|
321
|
+
* Returns the first module that supports the given context.
|
|
322
|
+
*/
|
|
323
|
+
getEngineByContext(context: NodeContext): (AbstractEngine & AsciidocTemplate) | undefined;
|
|
320
324
|
/**
|
|
321
325
|
* Converts the provided node using one of the registered template
|
|
322
326
|
* engine modules. For more granular control, gain access to the
|
|
@@ -489,7 +493,7 @@ type AsciidocLoader = {
|
|
|
489
493
|
/**
|
|
490
494
|
* A list of transformers to apply for source code blocks.
|
|
491
495
|
*
|
|
492
|
-
* @default [
|
|
496
|
+
* @default [ transformAsciidocCallout ]
|
|
493
497
|
*/
|
|
494
498
|
transformers: Array<ShikiTransformer | ShikiTransformerFactoryFn>;
|
|
495
499
|
callouts: Partial<{
|
|
@@ -542,4 +546,4 @@ interface RawTemplate {
|
|
|
542
546
|
renderString(content: string, options?: Record<string, unknown>): string;
|
|
543
547
|
}
|
|
544
548
|
|
|
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,
|
|
549
|
+
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, AbstractEngine as b, type ShikiTransformerFactory as c };
|
|
@@ -317,6 +317,10 @@ declare class TemplateEngineRegistry {
|
|
|
317
317
|
* Returns the module that supports the given extension.
|
|
318
318
|
*/
|
|
319
319
|
getEngineByExtension(ext: string): (AbstractEngine & AsciidocTemplate) | undefined;
|
|
320
|
+
/**
|
|
321
|
+
* Returns the first module that supports the given context.
|
|
322
|
+
*/
|
|
323
|
+
getEngineByContext(context: NodeContext): (AbstractEngine & AsciidocTemplate) | undefined;
|
|
320
324
|
/**
|
|
321
325
|
* Converts the provided node using one of the registered template
|
|
322
326
|
* engine modules. For more granular control, gain access to the
|
|
@@ -489,7 +493,7 @@ type AsciidocLoader = {
|
|
|
489
493
|
/**
|
|
490
494
|
* A list of transformers to apply for source code blocks.
|
|
491
495
|
*
|
|
492
|
-
* @default [
|
|
496
|
+
* @default [ transformAsciidocCallout ]
|
|
493
497
|
*/
|
|
494
498
|
transformers: Array<ShikiTransformer | ShikiTransformerFactoryFn>;
|
|
495
499
|
callouts: Partial<{
|
|
@@ -542,4 +546,4 @@ interface RawTemplate {
|
|
|
542
546
|
renderString(content: string, options?: Record<string, unknown>): string;
|
|
543
547
|
}
|
|
544
548
|
|
|
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,
|
|
549
|
+
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, AbstractEngine as b, type ShikiTransformerFactory as c };
|
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
asciidocLoader: () => asciidocLoader,
|
|
34
|
+
transformAsciidocCallout: () => transformAsciidocCallout,
|
|
34
35
|
transformerPrompt: () => transformerPrompt
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -192,6 +193,14 @@ var TemplateEngineRegistry = class _TemplateEngineRegistry {
|
|
|
192
193
|
(m) => m.extensions.includes(ext)
|
|
193
194
|
);
|
|
194
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Returns the first module that supports the given context.
|
|
198
|
+
*/
|
|
199
|
+
getEngineByContext(context) {
|
|
200
|
+
return _TemplateEngineRegistry.modules.find(
|
|
201
|
+
(m) => m.hasContext(context)
|
|
202
|
+
);
|
|
203
|
+
}
|
|
195
204
|
/**
|
|
196
205
|
* Converts the provided node using one of the registered template
|
|
197
206
|
* engine modules. For more granular control, gain access to the
|
|
@@ -569,19 +578,20 @@ var sourceCodeConverter = (converterOptions) => {
|
|
|
569
578
|
return typeof transformer === "function" ? transformer(node) : transformer;
|
|
570
579
|
})
|
|
571
580
|
});
|
|
572
|
-
if (templateEngine
|
|
573
|
-
const { extension } = splitFilenameComponents(
|
|
574
|
-
|
|
575
|
-
extension || ""
|
|
581
|
+
if (templateEngine) {
|
|
582
|
+
const { extension } = splitFilenameComponents(
|
|
583
|
+
template ?? ""
|
|
576
584
|
);
|
|
577
|
-
|
|
585
|
+
const engine = extension ? templateEngine.getEngineByExtension(extension ?? "") : templateEngine.getEngineByContext(this.nodeContext);
|
|
586
|
+
if (template) {
|
|
578
587
|
const templateFile = (0, import_node_path2.resolve)(process.cwd(), template);
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
588
|
+
engine?.addContext(this.nodeContext, templateFile);
|
|
589
|
+
}
|
|
590
|
+
if (engine) {
|
|
591
|
+
return engine.renderNode(node, {
|
|
592
|
+
content: output,
|
|
593
|
+
lang
|
|
594
|
+
});
|
|
585
595
|
}
|
|
586
596
|
}
|
|
587
597
|
return output;
|
|
@@ -805,5 +815,6 @@ var transformerPrompt = (options) => {
|
|
|
805
815
|
// Annotate the CommonJS export names for ESM import in node:
|
|
806
816
|
0 && (module.exports = {
|
|
807
817
|
asciidocLoader,
|
|
818
|
+
transformAsciidocCallout,
|
|
808
819
|
transformerPrompt
|
|
809
820
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LoaderContext } from 'astro/loaders';
|
|
2
|
-
import { A as AsciidocLoader } from './index-
|
|
3
|
-
export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-
|
|
4
|
-
export {
|
|
2
|
+
import { A as AsciidocLoader } from './index-C8nJcG2h.cjs';
|
|
3
|
+
export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-C8nJcG2h.cjs';
|
|
4
|
+
export { transformAsciidocCallout, transformerPrompt } from './lib/shiki/transformers/index.cjs';
|
|
5
5
|
import 'shiki';
|
|
6
6
|
import 'asciidoctor';
|
|
7
7
|
import 'astro/zod';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LoaderContext } from 'astro/loaders';
|
|
2
|
-
import { A as AsciidocLoader } from './index-
|
|
3
|
-
export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-
|
|
4
|
-
export {
|
|
2
|
+
import { A as AsciidocLoader } from './index-C8nJcG2h.js';
|
|
3
|
+
export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-C8nJcG2h.js';
|
|
4
|
+
export { transformAsciidocCallout, transformerPrompt } from './lib/shiki/transformers/index.js';
|
|
5
5
|
import 'shiki';
|
|
6
6
|
import 'asciidoctor';
|
|
7
7
|
import 'astro/zod';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sourceCodeConverter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SUQERYPQ.js";
|
|
4
4
|
import {
|
|
5
5
|
transformAsciidocCallout,
|
|
6
6
|
transformerPrompt
|
|
@@ -155,6 +155,14 @@ var TemplateEngineRegistry = class _TemplateEngineRegistry {
|
|
|
155
155
|
(m) => m.extensions.includes(ext)
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Returns the first module that supports the given context.
|
|
160
|
+
*/
|
|
161
|
+
getEngineByContext(context) {
|
|
162
|
+
return _TemplateEngineRegistry.modules.find(
|
|
163
|
+
(m) => m.hasContext(context)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
158
166
|
/**
|
|
159
167
|
* Converts the provided node using one of the registered template
|
|
160
168
|
* engine modules. For more granular control, gain access to the
|
|
@@ -483,5 +491,6 @@ async function setDocument(doc, converters, templateEngine, { parseData, store }
|
|
|
483
491
|
}
|
|
484
492
|
export {
|
|
485
493
|
asciidocLoader,
|
|
494
|
+
transformAsciidocCallout,
|
|
486
495
|
transformerPrompt
|
|
487
496
|
};
|
|
@@ -55,19 +55,20 @@ var sourceCodeConverter = (converterOptions) => {
|
|
|
55
55
|
return typeof transformer === "function" ? transformer(node) : transformer;
|
|
56
56
|
})
|
|
57
57
|
});
|
|
58
|
-
if (templateEngine
|
|
59
|
-
const { extension } = splitFilenameComponents(
|
|
60
|
-
|
|
61
|
-
extension || ""
|
|
58
|
+
if (templateEngine) {
|
|
59
|
+
const { extension } = splitFilenameComponents(
|
|
60
|
+
template ?? ""
|
|
62
61
|
);
|
|
63
|
-
|
|
62
|
+
const engine = extension ? templateEngine.getEngineByExtension(extension ?? "") : templateEngine.getEngineByContext(this.nodeContext);
|
|
63
|
+
if (template) {
|
|
64
64
|
const templateFile = (0, import_node_path.resolve)(process.cwd(), template);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
engine?.addContext(this.nodeContext, templateFile);
|
|
66
|
+
}
|
|
67
|
+
if (engine) {
|
|
68
|
+
return engine.renderNode(node, {
|
|
69
|
+
content: output,
|
|
70
|
+
lang
|
|
71
|
+
});
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
return output;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShikiTransformer } from 'shiki';
|
|
2
|
-
import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-
|
|
2
|
+
import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-C8nJcG2h.cjs';
|
|
3
3
|
import 'asciidoctor';
|
|
4
4
|
import 'astro/zod';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShikiTransformer } from 'shiki';
|
|
2
|
-
import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-
|
|
2
|
+
import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-C8nJcG2h.js';
|
|
3
3
|
import 'asciidoctor';
|
|
4
4
|
import 'astro/zod';
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-C8nJcG2h.cjs';
|
|
2
2
|
import { AbstractBlock } from 'asciidoctor';
|
|
3
3
|
import 'shiki';
|
|
4
4
|
import 'astro/zod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-C8nJcG2h.js';
|
|
2
2
|
import { AbstractBlock } from 'asciidoctor';
|
|
3
3
|
import 'shiki';
|
|
4
4
|
import 'astro/zod';
|
|
@@ -1,13 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { c as ShikiTransformerFactory } from '../../../index-C8nJcG2h.cjs';
|
|
2
|
+
import { BundledLanguage } from 'shiki/types';
|
|
3
3
|
import 'shiki';
|
|
4
4
|
import 'asciidoctor';
|
|
5
5
|
import 'astro/zod';
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
type PromptOptions = {
|
|
8
|
+
prompt: string;
|
|
9
|
+
cssClasses: string;
|
|
10
|
+
};
|
|
11
|
+
type TransformOptions = {
|
|
12
|
+
/**
|
|
13
|
+
* String of CSS classes to apply to leading prompt character(s) on
|
|
14
|
+
* source code blocks of type console.
|
|
15
|
+
*/
|
|
16
|
+
cssClasses?: string;
|
|
17
|
+
/**
|
|
18
|
+
* An object mapping each language block to a prompt string. An object
|
|
19
|
+
* can also be provided specified with two keys, the prompt and the
|
|
20
|
+
* css classes that modify this prompt in particular. Useful when you
|
|
21
|
+
* want to style them differently from the
|
|
22
|
+
* If not provided, it will default to look at the block attribute.
|
|
23
|
+
*/
|
|
24
|
+
langs?: Partial<Record<BundledLanguage, PromptOptions | string>>;
|
|
25
|
+
/**
|
|
26
|
+
* The name of the block attribute on the original document to look
|
|
27
|
+
* for and use as the prompt for this block.
|
|
28
|
+
*
|
|
29
|
+
* @default custom-prompt
|
|
30
|
+
*/
|
|
31
|
+
promptAttribute?: string;
|
|
32
|
+
};
|
|
33
|
+
declare const transformerPrompt: ShikiTransformerFactory<TransformOptions>;
|
|
7
34
|
|
|
8
35
|
type TransformerOptions = Partial<{
|
|
9
36
|
cssClasses?: string;
|
|
10
37
|
}>;
|
|
11
38
|
declare const transformAsciidocCallout: ShikiTransformerFactory<TransformerOptions>;
|
|
12
39
|
|
|
13
|
-
export { transformAsciidocCallout };
|
|
40
|
+
export { transformAsciidocCallout, transformerPrompt };
|
|
@@ -1,13 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { c as ShikiTransformerFactory } from '../../../index-C8nJcG2h.js';
|
|
2
|
+
import { BundledLanguage } from 'shiki/types';
|
|
3
3
|
import 'shiki';
|
|
4
4
|
import 'asciidoctor';
|
|
5
5
|
import 'astro/zod';
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
type PromptOptions = {
|
|
8
|
+
prompt: string;
|
|
9
|
+
cssClasses: string;
|
|
10
|
+
};
|
|
11
|
+
type TransformOptions = {
|
|
12
|
+
/**
|
|
13
|
+
* String of CSS classes to apply to leading prompt character(s) on
|
|
14
|
+
* source code blocks of type console.
|
|
15
|
+
*/
|
|
16
|
+
cssClasses?: string;
|
|
17
|
+
/**
|
|
18
|
+
* An object mapping each language block to a prompt string. An object
|
|
19
|
+
* can also be provided specified with two keys, the prompt and the
|
|
20
|
+
* css classes that modify this prompt in particular. Useful when you
|
|
21
|
+
* want to style them differently from the
|
|
22
|
+
* If not provided, it will default to look at the block attribute.
|
|
23
|
+
*/
|
|
24
|
+
langs?: Partial<Record<BundledLanguage, PromptOptions | string>>;
|
|
25
|
+
/**
|
|
26
|
+
* The name of the block attribute on the original document to look
|
|
27
|
+
* for and use as the prompt for this block.
|
|
28
|
+
*
|
|
29
|
+
* @default custom-prompt
|
|
30
|
+
*/
|
|
31
|
+
promptAttribute?: string;
|
|
32
|
+
};
|
|
33
|
+
declare const transformerPrompt: ShikiTransformerFactory<TransformOptions>;
|
|
7
34
|
|
|
8
35
|
type TransformerOptions = Partial<{
|
|
9
36
|
cssClasses?: string;
|
|
10
37
|
}>;
|
|
11
38
|
declare const transformAsciidocCallout: ShikiTransformerFactory<TransformerOptions>;
|
|
12
39
|
|
|
13
|
-
export { transformAsciidocCallout };
|
|
40
|
+
export { transformAsciidocCallout, transformerPrompt };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d10f/asciidoc-astro-loader",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "An Astro collections loader for Asciidoc files",
|
|
5
5
|
"author": "D10f",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@shikijs/transformers": "^3.20.0",
|
|
53
53
|
"asciidoctor": "^3.0.4",
|
|
54
|
-
"shiki": "^3.
|
|
54
|
+
"shiki": "^3.20.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"astro": "^5.0.0"
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { BundledLanguage } from 'shiki/types';
|
|
2
|
-
import { b as ShikiTransformerFactory } from './index-PY1MiQbP.js';
|
|
3
|
-
|
|
4
|
-
type PromptOptions = {
|
|
5
|
-
prompt: string;
|
|
6
|
-
cssClasses: string;
|
|
7
|
-
};
|
|
8
|
-
type TransformOptions = {
|
|
9
|
-
/**
|
|
10
|
-
* String of CSS classes to apply to leading prompt character(s) on
|
|
11
|
-
* source code blocks of type console.
|
|
12
|
-
*/
|
|
13
|
-
cssClasses?: string;
|
|
14
|
-
/**
|
|
15
|
-
* An object mapping each language block to a prompt string. An object
|
|
16
|
-
* can also be provided specified with two keys, the prompt and the
|
|
17
|
-
* css classes that modify this prompt in particular. Useful when you
|
|
18
|
-
* want to style them differently from the
|
|
19
|
-
* If not provided, it will default to look at the block attribute.
|
|
20
|
-
*/
|
|
21
|
-
langs?: Partial<Record<BundledLanguage, PromptOptions | string>>;
|
|
22
|
-
/**
|
|
23
|
-
* The name of the block attribute on the original document to look
|
|
24
|
-
* for and use as the prompt for this block.
|
|
25
|
-
*
|
|
26
|
-
* @default custom-prompt
|
|
27
|
-
*/
|
|
28
|
-
promptAttribute?: string;
|
|
29
|
-
};
|
|
30
|
-
declare const transformerPrompt: ShikiTransformerFactory<TransformOptions>;
|
|
31
|
-
|
|
32
|
-
export { transformerPrompt as t };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { BundledLanguage } from 'shiki/types';
|
|
2
|
-
import { b as ShikiTransformerFactory } from './index-PY1MiQbP.cjs';
|
|
3
|
-
|
|
4
|
-
type PromptOptions = {
|
|
5
|
-
prompt: string;
|
|
6
|
-
cssClasses: string;
|
|
7
|
-
};
|
|
8
|
-
type TransformOptions = {
|
|
9
|
-
/**
|
|
10
|
-
* String of CSS classes to apply to leading prompt character(s) on
|
|
11
|
-
* source code blocks of type console.
|
|
12
|
-
*/
|
|
13
|
-
cssClasses?: string;
|
|
14
|
-
/**
|
|
15
|
-
* An object mapping each language block to a prompt string. An object
|
|
16
|
-
* can also be provided specified with two keys, the prompt and the
|
|
17
|
-
* css classes that modify this prompt in particular. Useful when you
|
|
18
|
-
* want to style them differently from the
|
|
19
|
-
* If not provided, it will default to look at the block attribute.
|
|
20
|
-
*/
|
|
21
|
-
langs?: Partial<Record<BundledLanguage, PromptOptions | string>>;
|
|
22
|
-
/**
|
|
23
|
-
* The name of the block attribute on the original document to look
|
|
24
|
-
* for and use as the prompt for this block.
|
|
25
|
-
*
|
|
26
|
-
* @default custom-prompt
|
|
27
|
-
*/
|
|
28
|
-
promptAttribute?: string;
|
|
29
|
-
};
|
|
30
|
-
declare const transformerPrompt: ShikiTransformerFactory<TransformOptions>;
|
|
31
|
-
|
|
32
|
-
export { transformerPrompt as t };
|