@openuji/speculator 0.1.0 → 0.2.0
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 +15 -0
- package/dist/browser.cjs +908 -0
- package/dist/browser.d.cts +238 -0
- package/dist/browser.d.ts +238 -0
- package/dist/browser.js +26 -0
- package/dist/chunk-JAR5PGCK.js +862 -0
- package/dist/node.cjs +930 -0
- package/dist/node.d.cts +17 -0
- package/dist/node.d.ts +17 -0
- package/dist/node.js +47 -0
- package/package.json +28 -8
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +0 -1
- package/dist/markdown/index.d.ts +0 -5
- package/dist/markdown/index.d.ts.map +0 -1
- package/dist/markdown/index.js +0 -70
- package/dist/markdown/index.js.map +0 -1
- package/dist/markdown/plugins/cite.d.ts +0 -3
- package/dist/markdown/plugins/cite.d.ts.map +0 -1
- package/dist/markdown/plugins/cite.js +0 -36
- package/dist/markdown/plugins/cite.js.map +0 -1
- package/dist/markdown/plugins/concept.d.ts +0 -3
- package/dist/markdown/plugins/concept.d.ts.map +0 -1
- package/dist/markdown/plugins/concept.js +0 -30
- package/dist/markdown/plugins/concept.js.map +0 -1
- package/dist/markdown/plugins/idl.d.ts +0 -3
- package/dist/markdown/plugins/idl.d.ts.map +0 -1
- package/dist/markdown/plugins/idl.js +0 -28
- package/dist/markdown/plugins/idl.js.map +0 -1
- package/dist/pipeline/passes/boilerplate.d.ts +0 -3
- package/dist/pipeline/passes/boilerplate.d.ts.map +0 -1
- package/dist/pipeline/passes/boilerplate.js +0 -59
- package/dist/pipeline/passes/boilerplate.js.map +0 -1
- package/dist/pipeline/passes/diagnostics.d.ts +0 -3
- package/dist/pipeline/passes/diagnostics.d.ts.map +0 -1
- package/dist/pipeline/passes/diagnostics.js +0 -43
- package/dist/pipeline/passes/diagnostics.js.map +0 -1
- package/dist/pipeline/passes/idl.d.ts +0 -4
- package/dist/pipeline/passes/idl.d.ts.map +0 -1
- package/dist/pipeline/passes/idl.js +0 -188
- package/dist/pipeline/passes/idl.js.map +0 -1
- package/dist/pipeline/passes/references.d.ts +0 -3
- package/dist/pipeline/passes/references.d.ts.map +0 -1
- package/dist/pipeline/passes/references.js +0 -99
- package/dist/pipeline/passes/references.js.map +0 -1
- package/dist/pipeline/passes/toc.d.ts +0 -3
- package/dist/pipeline/passes/toc.d.ts.map +0 -1
- package/dist/pipeline/passes/toc.js +0 -30
- package/dist/pipeline/passes/toc.js.map +0 -1
- package/dist/pipeline/passes/xref.d.ts +0 -3
- package/dist/pipeline/passes/xref.d.ts.map +0 -1
- package/dist/pipeline/passes/xref.js +0 -132
- package/dist/pipeline/passes/xref.js.map +0 -1
- package/dist/pipeline/postprocess.d.ts +0 -6
- package/dist/pipeline/postprocess.d.ts.map +0 -1
- package/dist/pipeline/postprocess.js +0 -26
- package/dist/pipeline/postprocess.js.map +0 -1
- package/dist/speculator.d.ts +0 -40
- package/dist/speculator.d.ts.map +0 -1
- package/dist/speculator.js +0 -188
- package/dist/speculator.js.map +0 -1
- package/dist/types.d.ts +0 -146
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -16
- package/dist/types.js.map +0 -1
- package/dist/utils/file-loader.d.ts +0 -18
- package/dist/utils/file-loader.d.ts.map +0 -1
- package/dist/utils/file-loader.js +0 -100
- package/dist/utils/file-loader.js.map +0 -1
- package/dist/utils/strip-ident.d.ts +0 -2
- package/dist/utils/strip-ident.d.ts.map +0 -1
- package/dist/utils/strip-ident.js +0 -15
- package/dist/utils/strip-ident.js.map +0 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import MarkdownIt from 'markdown-it';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Service responsible for processing data-format attributes and markdown content.
|
|
5
|
+
*/
|
|
6
|
+
declare class FormatProcessor {
|
|
7
|
+
private readonly markdownOptions;
|
|
8
|
+
constructor(markdownOptions?: MarkdownOptions);
|
|
9
|
+
/**
|
|
10
|
+
* Convert content based on the specified format.
|
|
11
|
+
*/
|
|
12
|
+
processContent(content: string, format: DataFormat): string;
|
|
13
|
+
/**
|
|
14
|
+
* Process an element with a data-format attribute.
|
|
15
|
+
*/
|
|
16
|
+
process(element: Element, stats: ProcessingStats, warnings: string[]): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Service responsible for handling data-include attributes.
|
|
21
|
+
*/
|
|
22
|
+
declare class IncludeProcessor {
|
|
23
|
+
private readonly baseUrl;
|
|
24
|
+
private readonly fileLoader;
|
|
25
|
+
private readonly formatProcessor;
|
|
26
|
+
constructor(baseUrl: string | undefined, fileLoader: FileLoader, formatProcessor: FormatProcessor);
|
|
27
|
+
process(element: Element, stats: ProcessingStats, warnings: string[]): Promise<void>;
|
|
28
|
+
private resolveFilePath;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Abstraction over DOM parsing and serialization, allowing custom implementations.
|
|
33
|
+
*/
|
|
34
|
+
interface HtmlRenderer {
|
|
35
|
+
parse(html: string): Element;
|
|
36
|
+
serialize(element: Element): string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Default DOM-based implementation using DOMParser.
|
|
40
|
+
*/
|
|
41
|
+
declare class DOMHtmlRenderer implements HtmlRenderer {
|
|
42
|
+
parse(html: string): Element;
|
|
43
|
+
serialize(element: Element): string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Configuration options for Speculator
|
|
48
|
+
*/
|
|
49
|
+
interface SpeculatorOptions {
|
|
50
|
+
/** Base URL for resolving relative file paths */
|
|
51
|
+
baseUrl?: string;
|
|
52
|
+
/** Custom file loader function */
|
|
53
|
+
fileLoader?: FileLoader;
|
|
54
|
+
/** Markdown parsing options */
|
|
55
|
+
markdownOptions?: MarkdownOptions;
|
|
56
|
+
postprocess?: PostprocessOptions;
|
|
57
|
+
includeProcessor?: IncludeProcessor;
|
|
58
|
+
formatProcessor?: FormatProcessor;
|
|
59
|
+
htmlRenderer?: HtmlRenderer;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* File loader function type
|
|
63
|
+
*/
|
|
64
|
+
type FileLoader = (path: string) => Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Markdown parsing options
|
|
67
|
+
*/
|
|
68
|
+
interface MarkdownOptions {
|
|
69
|
+
/** Enable GitHub Flavored Markdown */
|
|
70
|
+
gfm?: boolean;
|
|
71
|
+
/** Enable line breaks */
|
|
72
|
+
breaks?: boolean;
|
|
73
|
+
/** Enable smart typography */
|
|
74
|
+
smartypants?: boolean;
|
|
75
|
+
/** Generate header IDs */
|
|
76
|
+
headerIds?: boolean;
|
|
77
|
+
/** Custom renderer extensions */
|
|
78
|
+
extensions?: Array<MarkdownIt.PluginSimple | [MarkdownIt.PluginWithOptions<any>, any]>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Processing result for a single element
|
|
82
|
+
*/
|
|
83
|
+
interface ProcessingResult {
|
|
84
|
+
/** The processed HTML element */
|
|
85
|
+
element: Element;
|
|
86
|
+
/** Any warnings encountered during processing */
|
|
87
|
+
warnings: string[];
|
|
88
|
+
/** Processing statistics */
|
|
89
|
+
stats: ProcessingStats;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Processing statistics
|
|
93
|
+
*/
|
|
94
|
+
interface ProcessingStats {
|
|
95
|
+
/** Number of elements processed */
|
|
96
|
+
elementsProcessed: number;
|
|
97
|
+
/** Number of files included */
|
|
98
|
+
filesIncluded: number;
|
|
99
|
+
/** Number of markdown blocks converted */
|
|
100
|
+
markdownBlocks: number;
|
|
101
|
+
/** Processing time in milliseconds */
|
|
102
|
+
processingTime: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Supported data formats
|
|
106
|
+
*/
|
|
107
|
+
type DataFormat = 'markdown' | 'text' | 'html';
|
|
108
|
+
/**
|
|
109
|
+
* Error thrown during rendering
|
|
110
|
+
*/
|
|
111
|
+
declare class SpeculatorError extends Error {
|
|
112
|
+
readonly element?: Element | undefined;
|
|
113
|
+
readonly path?: string | undefined;
|
|
114
|
+
constructor(message: string, element?: Element | undefined, path?: string | undefined);
|
|
115
|
+
}
|
|
116
|
+
type XrefQuery = {
|
|
117
|
+
term: string;
|
|
118
|
+
context?: string;
|
|
119
|
+
};
|
|
120
|
+
type XrefResult = {
|
|
121
|
+
href: string;
|
|
122
|
+
text?: string;
|
|
123
|
+
cite?: string;
|
|
124
|
+
};
|
|
125
|
+
interface XrefResolver {
|
|
126
|
+
resolveBatch(queries: XrefQuery[], specs?: string[]): Promise<Map<string, XrefResult>>;
|
|
127
|
+
}
|
|
128
|
+
interface XrefOptions {
|
|
129
|
+
specs?: string[];
|
|
130
|
+
resolver?: XrefResolver;
|
|
131
|
+
}
|
|
132
|
+
interface BiblioEntry {
|
|
133
|
+
id: string;
|
|
134
|
+
title?: string;
|
|
135
|
+
href?: string;
|
|
136
|
+
publisher?: string;
|
|
137
|
+
date?: string;
|
|
138
|
+
status?: string;
|
|
139
|
+
}
|
|
140
|
+
interface BiblioOptions {
|
|
141
|
+
/** Optional local entries (used in later steps). */
|
|
142
|
+
entries?: Record<string, BiblioEntry>;
|
|
143
|
+
}
|
|
144
|
+
interface IdlOptions {
|
|
145
|
+
enable?: boolean;
|
|
146
|
+
}
|
|
147
|
+
interface TocOptions {
|
|
148
|
+
/** CSS selector for the ToC mount point (default: '#toc'). */
|
|
149
|
+
selector?: string;
|
|
150
|
+
enabled?: boolean;
|
|
151
|
+
}
|
|
152
|
+
interface BoilerplateOptions {
|
|
153
|
+
conformance?: boolean | {
|
|
154
|
+
title?: string;
|
|
155
|
+
id?: string;
|
|
156
|
+
content?: string;
|
|
157
|
+
};
|
|
158
|
+
security?: boolean | {
|
|
159
|
+
title?: string;
|
|
160
|
+
id?: string;
|
|
161
|
+
content?: string;
|
|
162
|
+
};
|
|
163
|
+
privacy?: boolean | {
|
|
164
|
+
title?: string;
|
|
165
|
+
id?: string;
|
|
166
|
+
content?: string;
|
|
167
|
+
};
|
|
168
|
+
mount?: 'end' | 'before-references' | 'after-toc';
|
|
169
|
+
}
|
|
170
|
+
interface DiagnosticsOptions {
|
|
171
|
+
/** Suppress link warnings within elements having this class. */
|
|
172
|
+
suppressClass?: string;
|
|
173
|
+
}
|
|
174
|
+
interface DiagnosticsOptions {
|
|
175
|
+
suppressClass?: string;
|
|
176
|
+
/** Enable duplicate-id and missing-href checks (default true). */
|
|
177
|
+
idsAndLinks?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface PostprocessOptions {
|
|
180
|
+
xref?: XrefOptions;
|
|
181
|
+
biblio?: BiblioOptions;
|
|
182
|
+
idl?: IdlOptions;
|
|
183
|
+
toc?: TocOptions;
|
|
184
|
+
diagnostics?: DiagnosticsOptions;
|
|
185
|
+
}
|
|
186
|
+
interface PostprocessOptions {
|
|
187
|
+
xref?: XrefOptions;
|
|
188
|
+
biblio?: BiblioOptions;
|
|
189
|
+
idl?: IdlOptions;
|
|
190
|
+
toc?: TocOptions;
|
|
191
|
+
diagnostics?: DiagnosticsOptions;
|
|
192
|
+
boilerplate?: BoilerplateOptions;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Main Speculator renderer class
|
|
197
|
+
*/
|
|
198
|
+
declare class Speculator {
|
|
199
|
+
private readonly includeProcessor;
|
|
200
|
+
private readonly formatProcessor;
|
|
201
|
+
private readonly htmlRenderer;
|
|
202
|
+
private readonly postprocessOptions;
|
|
203
|
+
constructor(options?: SpeculatorOptions);
|
|
204
|
+
/**
|
|
205
|
+
* Process a single DOM element
|
|
206
|
+
*/
|
|
207
|
+
processElement(element: Element): Promise<ProcessingResult>;
|
|
208
|
+
/**
|
|
209
|
+
* Process an entire document
|
|
210
|
+
*/
|
|
211
|
+
renderDocument(container: Element): Promise<ProcessingResult>;
|
|
212
|
+
/**
|
|
213
|
+
* Process HTML string and return processed HTML
|
|
214
|
+
*/
|
|
215
|
+
renderHTML(html: string): Promise<string>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
declare function createMarkdownRenderer(options?: MarkdownOptions): MarkdownIt;
|
|
219
|
+
declare function parseMarkdown(markdown: string, options?: MarkdownOptions, env?: Record<string, any>): string;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Default file loader for Node.js environments
|
|
223
|
+
*/
|
|
224
|
+
declare const nodeFileLoader: FileLoader;
|
|
225
|
+
/**
|
|
226
|
+
* Default file loader for browser environments
|
|
227
|
+
*/
|
|
228
|
+
declare const browserFileLoader: FileLoader;
|
|
229
|
+
/**
|
|
230
|
+
* Creates a file loader that tries multiple loaders in sequence
|
|
231
|
+
*/
|
|
232
|
+
declare function createFallbackFileLoader(loaders: FileLoader[]): FileLoader;
|
|
233
|
+
/**
|
|
234
|
+
* Auto-detects the appropriate file loader for the current environment
|
|
235
|
+
*/
|
|
236
|
+
declare function getDefaultFileLoader(): FileLoader;
|
|
237
|
+
|
|
238
|
+
export { DOMHtmlRenderer, type DataFormat, type FileLoader, FormatProcessor, type HtmlRenderer, IncludeProcessor, type MarkdownOptions, type ProcessingResult, type ProcessingStats, Speculator, SpeculatorError, type SpeculatorOptions, browserFileLoader, createFallbackFileLoader, createMarkdownRenderer, getDefaultFileLoader, nodeFileLoader, parseMarkdown };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import MarkdownIt from 'markdown-it';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Service responsible for processing data-format attributes and markdown content.
|
|
5
|
+
*/
|
|
6
|
+
declare class FormatProcessor {
|
|
7
|
+
private readonly markdownOptions;
|
|
8
|
+
constructor(markdownOptions?: MarkdownOptions);
|
|
9
|
+
/**
|
|
10
|
+
* Convert content based on the specified format.
|
|
11
|
+
*/
|
|
12
|
+
processContent(content: string, format: DataFormat): string;
|
|
13
|
+
/**
|
|
14
|
+
* Process an element with a data-format attribute.
|
|
15
|
+
*/
|
|
16
|
+
process(element: Element, stats: ProcessingStats, warnings: string[]): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Service responsible for handling data-include attributes.
|
|
21
|
+
*/
|
|
22
|
+
declare class IncludeProcessor {
|
|
23
|
+
private readonly baseUrl;
|
|
24
|
+
private readonly fileLoader;
|
|
25
|
+
private readonly formatProcessor;
|
|
26
|
+
constructor(baseUrl: string | undefined, fileLoader: FileLoader, formatProcessor: FormatProcessor);
|
|
27
|
+
process(element: Element, stats: ProcessingStats, warnings: string[]): Promise<void>;
|
|
28
|
+
private resolveFilePath;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Abstraction over DOM parsing and serialization, allowing custom implementations.
|
|
33
|
+
*/
|
|
34
|
+
interface HtmlRenderer {
|
|
35
|
+
parse(html: string): Element;
|
|
36
|
+
serialize(element: Element): string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Default DOM-based implementation using DOMParser.
|
|
40
|
+
*/
|
|
41
|
+
declare class DOMHtmlRenderer implements HtmlRenderer {
|
|
42
|
+
parse(html: string): Element;
|
|
43
|
+
serialize(element: Element): string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Configuration options for Speculator
|
|
48
|
+
*/
|
|
49
|
+
interface SpeculatorOptions {
|
|
50
|
+
/** Base URL for resolving relative file paths */
|
|
51
|
+
baseUrl?: string;
|
|
52
|
+
/** Custom file loader function */
|
|
53
|
+
fileLoader?: FileLoader;
|
|
54
|
+
/** Markdown parsing options */
|
|
55
|
+
markdownOptions?: MarkdownOptions;
|
|
56
|
+
postprocess?: PostprocessOptions;
|
|
57
|
+
includeProcessor?: IncludeProcessor;
|
|
58
|
+
formatProcessor?: FormatProcessor;
|
|
59
|
+
htmlRenderer?: HtmlRenderer;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* File loader function type
|
|
63
|
+
*/
|
|
64
|
+
type FileLoader = (path: string) => Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Markdown parsing options
|
|
67
|
+
*/
|
|
68
|
+
interface MarkdownOptions {
|
|
69
|
+
/** Enable GitHub Flavored Markdown */
|
|
70
|
+
gfm?: boolean;
|
|
71
|
+
/** Enable line breaks */
|
|
72
|
+
breaks?: boolean;
|
|
73
|
+
/** Enable smart typography */
|
|
74
|
+
smartypants?: boolean;
|
|
75
|
+
/** Generate header IDs */
|
|
76
|
+
headerIds?: boolean;
|
|
77
|
+
/** Custom renderer extensions */
|
|
78
|
+
extensions?: Array<MarkdownIt.PluginSimple | [MarkdownIt.PluginWithOptions<any>, any]>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Processing result for a single element
|
|
82
|
+
*/
|
|
83
|
+
interface ProcessingResult {
|
|
84
|
+
/** The processed HTML element */
|
|
85
|
+
element: Element;
|
|
86
|
+
/** Any warnings encountered during processing */
|
|
87
|
+
warnings: string[];
|
|
88
|
+
/** Processing statistics */
|
|
89
|
+
stats: ProcessingStats;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Processing statistics
|
|
93
|
+
*/
|
|
94
|
+
interface ProcessingStats {
|
|
95
|
+
/** Number of elements processed */
|
|
96
|
+
elementsProcessed: number;
|
|
97
|
+
/** Number of files included */
|
|
98
|
+
filesIncluded: number;
|
|
99
|
+
/** Number of markdown blocks converted */
|
|
100
|
+
markdownBlocks: number;
|
|
101
|
+
/** Processing time in milliseconds */
|
|
102
|
+
processingTime: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Supported data formats
|
|
106
|
+
*/
|
|
107
|
+
type DataFormat = 'markdown' | 'text' | 'html';
|
|
108
|
+
/**
|
|
109
|
+
* Error thrown during rendering
|
|
110
|
+
*/
|
|
111
|
+
declare class SpeculatorError extends Error {
|
|
112
|
+
readonly element?: Element | undefined;
|
|
113
|
+
readonly path?: string | undefined;
|
|
114
|
+
constructor(message: string, element?: Element | undefined, path?: string | undefined);
|
|
115
|
+
}
|
|
116
|
+
type XrefQuery = {
|
|
117
|
+
term: string;
|
|
118
|
+
context?: string;
|
|
119
|
+
};
|
|
120
|
+
type XrefResult = {
|
|
121
|
+
href: string;
|
|
122
|
+
text?: string;
|
|
123
|
+
cite?: string;
|
|
124
|
+
};
|
|
125
|
+
interface XrefResolver {
|
|
126
|
+
resolveBatch(queries: XrefQuery[], specs?: string[]): Promise<Map<string, XrefResult>>;
|
|
127
|
+
}
|
|
128
|
+
interface XrefOptions {
|
|
129
|
+
specs?: string[];
|
|
130
|
+
resolver?: XrefResolver;
|
|
131
|
+
}
|
|
132
|
+
interface BiblioEntry {
|
|
133
|
+
id: string;
|
|
134
|
+
title?: string;
|
|
135
|
+
href?: string;
|
|
136
|
+
publisher?: string;
|
|
137
|
+
date?: string;
|
|
138
|
+
status?: string;
|
|
139
|
+
}
|
|
140
|
+
interface BiblioOptions {
|
|
141
|
+
/** Optional local entries (used in later steps). */
|
|
142
|
+
entries?: Record<string, BiblioEntry>;
|
|
143
|
+
}
|
|
144
|
+
interface IdlOptions {
|
|
145
|
+
enable?: boolean;
|
|
146
|
+
}
|
|
147
|
+
interface TocOptions {
|
|
148
|
+
/** CSS selector for the ToC mount point (default: '#toc'). */
|
|
149
|
+
selector?: string;
|
|
150
|
+
enabled?: boolean;
|
|
151
|
+
}
|
|
152
|
+
interface BoilerplateOptions {
|
|
153
|
+
conformance?: boolean | {
|
|
154
|
+
title?: string;
|
|
155
|
+
id?: string;
|
|
156
|
+
content?: string;
|
|
157
|
+
};
|
|
158
|
+
security?: boolean | {
|
|
159
|
+
title?: string;
|
|
160
|
+
id?: string;
|
|
161
|
+
content?: string;
|
|
162
|
+
};
|
|
163
|
+
privacy?: boolean | {
|
|
164
|
+
title?: string;
|
|
165
|
+
id?: string;
|
|
166
|
+
content?: string;
|
|
167
|
+
};
|
|
168
|
+
mount?: 'end' | 'before-references' | 'after-toc';
|
|
169
|
+
}
|
|
170
|
+
interface DiagnosticsOptions {
|
|
171
|
+
/** Suppress link warnings within elements having this class. */
|
|
172
|
+
suppressClass?: string;
|
|
173
|
+
}
|
|
174
|
+
interface DiagnosticsOptions {
|
|
175
|
+
suppressClass?: string;
|
|
176
|
+
/** Enable duplicate-id and missing-href checks (default true). */
|
|
177
|
+
idsAndLinks?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface PostprocessOptions {
|
|
180
|
+
xref?: XrefOptions;
|
|
181
|
+
biblio?: BiblioOptions;
|
|
182
|
+
idl?: IdlOptions;
|
|
183
|
+
toc?: TocOptions;
|
|
184
|
+
diagnostics?: DiagnosticsOptions;
|
|
185
|
+
}
|
|
186
|
+
interface PostprocessOptions {
|
|
187
|
+
xref?: XrefOptions;
|
|
188
|
+
biblio?: BiblioOptions;
|
|
189
|
+
idl?: IdlOptions;
|
|
190
|
+
toc?: TocOptions;
|
|
191
|
+
diagnostics?: DiagnosticsOptions;
|
|
192
|
+
boilerplate?: BoilerplateOptions;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Main Speculator renderer class
|
|
197
|
+
*/
|
|
198
|
+
declare class Speculator {
|
|
199
|
+
private readonly includeProcessor;
|
|
200
|
+
private readonly formatProcessor;
|
|
201
|
+
private readonly htmlRenderer;
|
|
202
|
+
private readonly postprocessOptions;
|
|
203
|
+
constructor(options?: SpeculatorOptions);
|
|
204
|
+
/**
|
|
205
|
+
* Process a single DOM element
|
|
206
|
+
*/
|
|
207
|
+
processElement(element: Element): Promise<ProcessingResult>;
|
|
208
|
+
/**
|
|
209
|
+
* Process an entire document
|
|
210
|
+
*/
|
|
211
|
+
renderDocument(container: Element): Promise<ProcessingResult>;
|
|
212
|
+
/**
|
|
213
|
+
* Process HTML string and return processed HTML
|
|
214
|
+
*/
|
|
215
|
+
renderHTML(html: string): Promise<string>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
declare function createMarkdownRenderer(options?: MarkdownOptions): MarkdownIt;
|
|
219
|
+
declare function parseMarkdown(markdown: string, options?: MarkdownOptions, env?: Record<string, any>): string;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Default file loader for Node.js environments
|
|
223
|
+
*/
|
|
224
|
+
declare const nodeFileLoader: FileLoader;
|
|
225
|
+
/**
|
|
226
|
+
* Default file loader for browser environments
|
|
227
|
+
*/
|
|
228
|
+
declare const browserFileLoader: FileLoader;
|
|
229
|
+
/**
|
|
230
|
+
* Creates a file loader that tries multiple loaders in sequence
|
|
231
|
+
*/
|
|
232
|
+
declare function createFallbackFileLoader(loaders: FileLoader[]): FileLoader;
|
|
233
|
+
/**
|
|
234
|
+
* Auto-detects the appropriate file loader for the current environment
|
|
235
|
+
*/
|
|
236
|
+
declare function getDefaultFileLoader(): FileLoader;
|
|
237
|
+
|
|
238
|
+
export { DOMHtmlRenderer, type DataFormat, type FileLoader, FormatProcessor, type HtmlRenderer, IncludeProcessor, type MarkdownOptions, type ProcessingResult, type ProcessingStats, Speculator, SpeculatorError, type SpeculatorOptions, browserFileLoader, createFallbackFileLoader, createMarkdownRenderer, getDefaultFileLoader, nodeFileLoader, parseMarkdown };
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DOMHtmlRenderer,
|
|
3
|
+
FormatProcessor,
|
|
4
|
+
IncludeProcessor,
|
|
5
|
+
Speculator,
|
|
6
|
+
SpeculatorError,
|
|
7
|
+
browserFileLoader,
|
|
8
|
+
createFallbackFileLoader,
|
|
9
|
+
createMarkdownRenderer,
|
|
10
|
+
getDefaultFileLoader,
|
|
11
|
+
nodeFileLoader,
|
|
12
|
+
parseMarkdown
|
|
13
|
+
} from "./chunk-JAR5PGCK.js";
|
|
14
|
+
export {
|
|
15
|
+
DOMHtmlRenderer,
|
|
16
|
+
FormatProcessor,
|
|
17
|
+
IncludeProcessor,
|
|
18
|
+
Speculator,
|
|
19
|
+
SpeculatorError,
|
|
20
|
+
browserFileLoader,
|
|
21
|
+
createFallbackFileLoader,
|
|
22
|
+
createMarkdownRenderer,
|
|
23
|
+
getDefaultFileLoader,
|
|
24
|
+
nodeFileLoader,
|
|
25
|
+
parseMarkdown
|
|
26
|
+
};
|