@d10f/asciidoc-astro-loader 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TCLZUBH3.js → chunk-KPBQHX55.js} +1 -1
- package/dist/{index-B1d5alka.d.cts → index-Bbw2Lfb5.d.cts} +24 -3
- package/dist/{index-B1d5alka.d.ts → index-Bbw2Lfb5.d.ts} +24 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/lib/asciidoc/converters/index.d.cts +1 -1
- package/dist/lib/asciidoc/converters/index.d.ts +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.cjs +1 -1
- package/dist/lib/shiki/transformers/index.d.cts +1 -1
- package/dist/lib/shiki/transformers/index.d.ts +1 -1
- package/dist/lib/shiki/transformers/index.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
// src/lib/shiki/transformers/transformAsciidocCallout.ts
|
|
6
6
|
var transformAsciidocCallout = (options) => {
|
|
7
7
|
return (node) => {
|
|
8
|
-
const lineComments = ["//", "#", ";;", "%"];
|
|
8
|
+
const lineComments = ["//", "#", ";;", "%", "--"];
|
|
9
9
|
const customLineComment = node.getAttribute("line-comment");
|
|
10
10
|
if (customLineComment) {
|
|
11
11
|
lineComments.push(escapeRegexCharacters(customLineComment));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HighlighterCore, CodeToHastOptions, CodeOptionsMultipleThemes, StringLiteralUnion, BundledTheme, ShikiTransformer } from 'shiki';
|
|
2
|
-
import { AbstractNode, AbstractBlock } from 'asciidoctor';
|
|
1
|
+
import { BundledLanguage, HighlighterCore, CodeToHastOptions, CodeOptionsMultipleThemes, StringLiteralUnion, BundledTheme, ShikiTransformer } from 'shiki';
|
|
2
|
+
import { AbstractNode, AbstractBlock, Document } from 'asciidoctor';
|
|
3
3
|
import { z } from 'astro/zod';
|
|
4
4
|
|
|
5
5
|
type RequiredOptions = z.output<typeof loaderOptionsSchema>;
|
|
@@ -169,6 +169,27 @@ declare class TemplateEngineRegistry {
|
|
|
169
169
|
private loadTemplates;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
declare class AsciidocDocument {
|
|
173
|
+
private document;
|
|
174
|
+
private baseConverter;
|
|
175
|
+
constructor(filepath: string);
|
|
176
|
+
private get documentTitle();
|
|
177
|
+
get attributes(): any;
|
|
178
|
+
get title(): string;
|
|
179
|
+
get subtitle(): string;
|
|
180
|
+
get slug(): string;
|
|
181
|
+
get preamble(): string | undefined;
|
|
182
|
+
get description(): string;
|
|
183
|
+
get author(): string;
|
|
184
|
+
get authors(): Document.Author[];
|
|
185
|
+
get version(): string;
|
|
186
|
+
get createdAt(): string;
|
|
187
|
+
get keywords(): any;
|
|
188
|
+
get languages(): Set<BundledLanguage>;
|
|
189
|
+
setAttribute(attribute: string, value: string): void;
|
|
190
|
+
convert(converters?: CustomConverter[], templateEngine?: TemplateEngineRegistry): string;
|
|
191
|
+
}
|
|
192
|
+
|
|
172
193
|
/**
|
|
173
194
|
* Checks if the given property K is required in object T.
|
|
174
195
|
*
|
|
@@ -206,7 +227,7 @@ type CustomConverter = {
|
|
|
206
227
|
convert(node: AbstractNode, templateEngine?: TemplateEngineRegistry): string | null | undefined;
|
|
207
228
|
};
|
|
208
229
|
type CustomConverterFactoryFn<T extends object> = HasRequiredKeys<T> extends true ? (converterOptions: T) => CustomConverterFn : (converterOptions?: T) => CustomConverterFn;
|
|
209
|
-
type CustomConverterFn = (opts: RequiredOptions, highlighter: HighlighterCore) => CustomConverter;
|
|
230
|
+
type CustomConverterFn = (opts: RequiredOptions, highlighter: HighlighterCore, docs: AsciidocDocument[]) => CustomConverter;
|
|
210
231
|
type ShikiTransformerFactory<T extends object> = HasRequiredKeys<T> extends true ? (options: T) => ShikiTransformerFactoryFn : (options?: T) => ShikiTransformerFactoryFn;
|
|
211
232
|
type ShikiTransformerFactoryFn = (node: AbstractNode) => ShikiTransformer;
|
|
212
233
|
type CalloutOptions = Partial<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HighlighterCore, CodeToHastOptions, CodeOptionsMultipleThemes, StringLiteralUnion, BundledTheme, ShikiTransformer } from 'shiki';
|
|
2
|
-
import { AbstractNode, AbstractBlock } from 'asciidoctor';
|
|
1
|
+
import { BundledLanguage, HighlighterCore, CodeToHastOptions, CodeOptionsMultipleThemes, StringLiteralUnion, BundledTheme, ShikiTransformer } from 'shiki';
|
|
2
|
+
import { AbstractNode, AbstractBlock, Document } from 'asciidoctor';
|
|
3
3
|
import { z } from 'astro/zod';
|
|
4
4
|
|
|
5
5
|
type RequiredOptions = z.output<typeof loaderOptionsSchema>;
|
|
@@ -169,6 +169,27 @@ declare class TemplateEngineRegistry {
|
|
|
169
169
|
private loadTemplates;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
declare class AsciidocDocument {
|
|
173
|
+
private document;
|
|
174
|
+
private baseConverter;
|
|
175
|
+
constructor(filepath: string);
|
|
176
|
+
private get documentTitle();
|
|
177
|
+
get attributes(): any;
|
|
178
|
+
get title(): string;
|
|
179
|
+
get subtitle(): string;
|
|
180
|
+
get slug(): string;
|
|
181
|
+
get preamble(): string | undefined;
|
|
182
|
+
get description(): string;
|
|
183
|
+
get author(): string;
|
|
184
|
+
get authors(): Document.Author[];
|
|
185
|
+
get version(): string;
|
|
186
|
+
get createdAt(): string;
|
|
187
|
+
get keywords(): any;
|
|
188
|
+
get languages(): Set<BundledLanguage>;
|
|
189
|
+
setAttribute(attribute: string, value: string): void;
|
|
190
|
+
convert(converters?: CustomConverter[], templateEngine?: TemplateEngineRegistry): string;
|
|
191
|
+
}
|
|
192
|
+
|
|
172
193
|
/**
|
|
173
194
|
* Checks if the given property K is required in object T.
|
|
174
195
|
*
|
|
@@ -206,7 +227,7 @@ type CustomConverter = {
|
|
|
206
227
|
convert(node: AbstractNode, templateEngine?: TemplateEngineRegistry): string | null | undefined;
|
|
207
228
|
};
|
|
208
229
|
type CustomConverterFactoryFn<T extends object> = HasRequiredKeys<T> extends true ? (converterOptions: T) => CustomConverterFn : (converterOptions?: T) => CustomConverterFn;
|
|
209
|
-
type CustomConverterFn = (opts: RequiredOptions, highlighter: HighlighterCore) => CustomConverter;
|
|
230
|
+
type CustomConverterFn = (opts: RequiredOptions, highlighter: HighlighterCore, docs: AsciidocDocument[]) => CustomConverter;
|
|
210
231
|
type ShikiTransformerFactory<T extends object> = HasRequiredKeys<T> extends true ? (options: T) => ShikiTransformerFactoryFn : (options?: T) => ShikiTransformerFactoryFn;
|
|
211
232
|
type ShikiTransformerFactoryFn = (node: AbstractNode) => ShikiTransformer;
|
|
212
233
|
type CalloutOptions = Partial<{
|
package/dist/index.cjs
CHANGED
|
@@ -617,7 +617,7 @@ var sourceCodeConverter = (converterOptions) => {
|
|
|
617
617
|
// src/lib/shiki/transformers/transformAsciidocCallout.ts
|
|
618
618
|
var transformAsciidocCallout = (options) => {
|
|
619
619
|
return (node) => {
|
|
620
|
-
const lineComments = ["//", "#", ";;", "%"];
|
|
620
|
+
const lineComments = ["//", "#", ";;", "%", "--"];
|
|
621
621
|
const customLineComment = node.getAttribute("line-comment");
|
|
622
622
|
if (customLineComment) {
|
|
623
623
|
lineComments.push(escapeRegexCharacters(customLineComment));
|
|
@@ -721,7 +721,7 @@ function asciidocLoader(_options) {
|
|
|
721
721
|
);
|
|
722
722
|
}
|
|
723
723
|
const converters = options.document.converters.map(
|
|
724
|
-
(converter) => converter(options, highlighter)
|
|
724
|
+
(converter) => converter(options, highlighter, docs)
|
|
725
725
|
);
|
|
726
726
|
const hasSourceCodeConverter = converters.find(
|
|
727
727
|
(converter) => converter.nodeContext === "listing" && converter?.nodeStyle === "source"
|
|
@@ -735,7 +735,7 @@ function asciidocLoader(_options) {
|
|
|
735
735
|
options.syntaxHighlighting.callouts
|
|
736
736
|
)
|
|
737
737
|
]
|
|
738
|
-
})(options, highlighter)
|
|
738
|
+
})(options, highlighter, docs)
|
|
739
739
|
);
|
|
740
740
|
}
|
|
741
741
|
await Promise.all(
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LoaderContext } from 'astro/loaders';
|
|
2
|
-
import { a as AsciidocLoader } from './index-
|
|
3
|
-
export { b as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-
|
|
2
|
+
import { a as AsciidocLoader } from './index-Bbw2Lfb5.cjs';
|
|
3
|
+
export { b as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-Bbw2Lfb5.cjs';
|
|
4
4
|
export { transformAsciidocCallout, transformerPrompt } from './lib/shiki/transformers/index.cjs';
|
|
5
5
|
import 'shiki';
|
|
6
6
|
import 'asciidoctor';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LoaderContext } from 'astro/loaders';
|
|
2
|
-
import { a as AsciidocLoader } from './index-
|
|
3
|
-
export { b as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-
|
|
2
|
+
import { a as AsciidocLoader } from './index-Bbw2Lfb5.js';
|
|
3
|
+
export { b as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-Bbw2Lfb5.js';
|
|
4
4
|
export { transformAsciidocCallout, transformerPrompt } from './lib/shiki/transformers/index.js';
|
|
5
5
|
import 'shiki';
|
|
6
6
|
import 'asciidoctor';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sourceCodeConverter
|
|
3
|
-
} from "./chunk-SUQERYPQ.js";
|
|
4
1
|
import {
|
|
5
2
|
transformAsciidocCallout,
|
|
6
3
|
transformerPrompt
|
|
7
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KPBQHX55.js";
|
|
5
|
+
import {
|
|
6
|
+
sourceCodeConverter
|
|
7
|
+
} from "./chunk-SUQERYPQ.js";
|
|
8
8
|
import {
|
|
9
9
|
slugify,
|
|
10
10
|
splitFilenameComponents
|
|
@@ -429,7 +429,7 @@ function asciidocLoader(_options) {
|
|
|
429
429
|
);
|
|
430
430
|
}
|
|
431
431
|
const converters = options.document.converters.map(
|
|
432
|
-
(converter) => converter(options, highlighter)
|
|
432
|
+
(converter) => converter(options, highlighter, docs)
|
|
433
433
|
);
|
|
434
434
|
const hasSourceCodeConverter = converters.find(
|
|
435
435
|
(converter) => converter.nodeContext === "listing" && converter?.nodeStyle === "source"
|
|
@@ -443,7 +443,7 @@ function asciidocLoader(_options) {
|
|
|
443
443
|
options.syntaxHighlighting.callouts
|
|
444
444
|
)
|
|
445
445
|
]
|
|
446
|
-
})(options, highlighter)
|
|
446
|
+
})(options, highlighter, docs)
|
|
447
447
|
);
|
|
448
448
|
}
|
|
449
449
|
await Promise.all(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShikiTransformer } from 'shiki';
|
|
2
|
-
import { C as CustomConverterFactoryFn, c as ShikiTransformerFactoryFn } from '../../../index-
|
|
2
|
+
import { C as CustomConverterFactoryFn, c as ShikiTransformerFactoryFn } from '../../../index-Bbw2Lfb5.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, c as ShikiTransformerFactoryFn } from '../../../index-
|
|
2
|
+
import { C as CustomConverterFactoryFn, c as ShikiTransformerFactoryFn } from '../../../index-Bbw2Lfb5.js';
|
|
3
3
|
import 'asciidoctor';
|
|
4
4
|
import 'astro/zod';
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AbstractEngine, b as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-
|
|
1
|
+
import { A as AbstractEngine, b as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-Bbw2Lfb5.cjs';
|
|
2
2
|
import { AbstractBlock } from 'asciidoctor';
|
|
3
3
|
import 'shiki';
|
|
4
4
|
import 'astro/zod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AbstractEngine, b as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-
|
|
1
|
+
import { A as AbstractEngine, b as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-Bbw2Lfb5.js';
|
|
2
2
|
import { AbstractBlock } from 'asciidoctor';
|
|
3
3
|
import 'shiki';
|
|
4
4
|
import 'astro/zod';
|
|
@@ -34,7 +34,7 @@ function escapeRegexCharacters(str) {
|
|
|
34
34
|
// src/lib/shiki/transformers/transformAsciidocCallout.ts
|
|
35
35
|
var transformAsciidocCallout = (options) => {
|
|
36
36
|
return (node) => {
|
|
37
|
-
const lineComments = ["//", "#", ";;", "%"];
|
|
37
|
+
const lineComments = ["//", "#", ";;", "%", "--"];
|
|
38
38
|
const customLineComment = node.getAttribute("line-comment");
|
|
39
39
|
if (customLineComment) {
|
|
40
40
|
lineComments.push(escapeRegexCharacters(customLineComment));
|