@ox-content/napi 2.3.0 → 2.5.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/index.d.ts +257 -247
- package/index.js +2 -0
- package/package.json +6 -6
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Takes an array of documents and returns a serialized search index as JSON.
|
|
7
7
|
*/
|
|
8
|
-
export declare function buildSearchIndex(documents: Array<JsSearchDocument>): string
|
|
8
|
+
export declare function buildSearchIndex(documents: Array<JsSearchDocument>): string
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Runs i18n checks on dictionaries against used translation keys.
|
|
@@ -13,36 +13,24 @@ export declare function buildSearchIndex(documents: Array<JsSearchDocument>): st
|
|
|
13
13
|
* `dict_dir` is the path to the i18n directory with locale subdirectories.
|
|
14
14
|
* `used_keys` is a list of translation keys found in source code.
|
|
15
15
|
*/
|
|
16
|
-
export declare function checkI18n(dictDir: string, usedKeys: Array<string>): I18NCheckResult
|
|
16
|
+
export declare function checkI18n(dictDir: string, usedKeys: Array<string>): I18NCheckResult
|
|
17
17
|
|
|
18
18
|
/** Extracts documented declarations from a JavaScript/TypeScript file using Oxc. */
|
|
19
|
-
export declare function extractFileDocs(
|
|
20
|
-
filePath: string,
|
|
21
|
-
includePrivate?: boolean | undefined | null,
|
|
22
|
-
): Array<JsSourceDocItem>;
|
|
19
|
+
export declare function extractFileDocs(filePath: string, includePrivate?: boolean | undefined | null): Array<JsSourceDocItem>
|
|
23
20
|
|
|
24
21
|
/**
|
|
25
22
|
* Extracts searchable content from Markdown source.
|
|
26
23
|
*
|
|
27
24
|
* Parses the Markdown and extracts title, body text, headings, and code.
|
|
28
25
|
*/
|
|
29
|
-
export declare function extractSearchContent(
|
|
30
|
-
source: string,
|
|
31
|
-
id: string,
|
|
32
|
-
url: string,
|
|
33
|
-
options?: JsParserOptions | undefined | null,
|
|
34
|
-
): JsSearchDocument;
|
|
26
|
+
export declare function extractSearchContent(source: string, id: string, url: string, options?: JsParserOptions | undefined | null): JsSearchDocument
|
|
35
27
|
|
|
36
28
|
/**
|
|
37
29
|
* Extracts translation keys from a TypeScript/JavaScript source string.
|
|
38
30
|
*
|
|
39
31
|
* Finds calls like `t('key')` and `$t('key')`.
|
|
40
32
|
*/
|
|
41
|
-
export declare function extractTranslationKeys(
|
|
42
|
-
source: string,
|
|
43
|
-
filePath: string,
|
|
44
|
-
functionNames?: Array<string> | undefined | null,
|
|
45
|
-
): Array<I18NKeyUsage>;
|
|
33
|
+
export declare function extractTranslationKeys(source: string, filePath: string, functionNames?: Array<string> | undefined | null): Array<I18NKeyUsage>
|
|
46
34
|
|
|
47
35
|
/**
|
|
48
36
|
* Generates an OG image as SVG.
|
|
@@ -50,482 +38,526 @@ export declare function extractTranslationKeys(
|
|
|
50
38
|
* This function generates an SVG representation of an OG image
|
|
51
39
|
* that can be used for social media previews.
|
|
52
40
|
*/
|
|
53
|
-
export declare function generateOgImageSvg(
|
|
54
|
-
data: JsOgImageData,
|
|
55
|
-
config?: JsOgImageConfig | undefined | null,
|
|
56
|
-
): string;
|
|
41
|
+
export declare function generateOgImageSvg(data: JsOgImageData, config?: JsOgImageConfig | undefined | null): string
|
|
57
42
|
|
|
58
43
|
/** Generates SSG HTML page with navigation and search. */
|
|
59
|
-
export declare function generateSsgHtml(
|
|
60
|
-
pageData: JsSsgPageData,
|
|
61
|
-
navGroups: Array<JsSsgNavGroup>,
|
|
62
|
-
config: JsSsgConfig,
|
|
63
|
-
): string;
|
|
44
|
+
export declare function generateSsgHtml(pageData: JsSsgPageData, navGroups: Array<JsSsgNavGroup>, config: JsSsgConfig): string
|
|
64
45
|
|
|
65
46
|
/** Result of i18n checking. */
|
|
66
47
|
export interface I18NCheckResult {
|
|
67
48
|
/** All diagnostics. */
|
|
68
|
-
diagnostics: Array<I18NDiagnostic
|
|
49
|
+
diagnostics: Array<I18NDiagnostic>
|
|
69
50
|
/** Number of errors. */
|
|
70
|
-
errorCount: number
|
|
51
|
+
errorCount: number
|
|
71
52
|
/** Number of warnings. */
|
|
72
|
-
warningCount: number
|
|
53
|
+
warningCount: number
|
|
73
54
|
}
|
|
74
55
|
|
|
75
56
|
/** A single i18n diagnostic. */
|
|
76
57
|
export interface I18NDiagnostic {
|
|
77
58
|
/** Severity: "error", "warning", or "info". */
|
|
78
|
-
severity: string
|
|
59
|
+
severity: string
|
|
79
60
|
/** Diagnostic message. */
|
|
80
|
-
message: string
|
|
61
|
+
message: string
|
|
81
62
|
/** Related translation key, if any. */
|
|
82
|
-
key?: string
|
|
63
|
+
key?: string
|
|
83
64
|
/** Related locale, if any. */
|
|
84
|
-
locale?: string
|
|
65
|
+
locale?: string
|
|
85
66
|
}
|
|
86
67
|
|
|
87
68
|
/** A translation key usage found in source code. */
|
|
88
69
|
export interface I18NKeyUsage {
|
|
89
70
|
/** The translation key. */
|
|
90
|
-
key: string
|
|
71
|
+
key: string
|
|
91
72
|
/** Source file path. */
|
|
92
|
-
filePath: string
|
|
73
|
+
filePath: string
|
|
93
74
|
/** Line number. */
|
|
94
|
-
line: number
|
|
75
|
+
line: number
|
|
95
76
|
/** Column number. */
|
|
96
|
-
column: number
|
|
77
|
+
column: number
|
|
97
78
|
/** End column number. */
|
|
98
|
-
endColumn: number
|
|
79
|
+
endColumn: number
|
|
99
80
|
}
|
|
100
81
|
|
|
101
82
|
/** Result of loading dictionaries. */
|
|
102
83
|
export interface I18NLoadResult {
|
|
103
84
|
/** Number of locales loaded. */
|
|
104
|
-
localeCount: number
|
|
85
|
+
localeCount: number
|
|
105
86
|
/** All locale tags. */
|
|
106
|
-
locales: Array<string
|
|
87
|
+
locales: Array<string>
|
|
107
88
|
/** Errors encountered during loading. */
|
|
108
|
-
errors: Array<string
|
|
89
|
+
errors: Array<string>
|
|
109
90
|
}
|
|
110
91
|
|
|
111
92
|
/** Entry page configuration. */
|
|
112
93
|
export interface JsEntryPageConfig {
|
|
113
94
|
/** Hero section. */
|
|
114
|
-
hero?: JsHeroConfig
|
|
95
|
+
hero?: JsHeroConfig
|
|
115
96
|
/** Feature cards. */
|
|
116
|
-
features?: Array<JsFeatureConfig
|
|
97
|
+
features?: Array<JsFeatureConfig>
|
|
117
98
|
}
|
|
118
99
|
|
|
119
100
|
/** Feature card for entry page. */
|
|
120
101
|
export interface JsFeatureConfig {
|
|
121
102
|
/** Icon - supports: "mdi:icon-name" (Iconify), image URL, or emoji. */
|
|
122
|
-
icon?: string
|
|
103
|
+
icon?: string
|
|
123
104
|
/** Feature title. */
|
|
124
|
-
title: string
|
|
105
|
+
title: string
|
|
125
106
|
/** Feature description. */
|
|
126
|
-
details?: string
|
|
107
|
+
details?: string
|
|
127
108
|
/** Optional link. */
|
|
128
|
-
link?: string
|
|
109
|
+
link?: string
|
|
129
110
|
/** Link text. */
|
|
130
|
-
linkText?: string
|
|
111
|
+
linkText?: string
|
|
131
112
|
}
|
|
132
113
|
|
|
133
114
|
/** Hero action for entry page. */
|
|
134
115
|
export interface JsHeroAction {
|
|
135
116
|
/** Button theme: "brand" or "alt". */
|
|
136
|
-
theme?: string
|
|
117
|
+
theme?: string
|
|
137
118
|
/** Button text. */
|
|
138
|
-
text: string
|
|
119
|
+
text: string
|
|
139
120
|
/** Link URL. */
|
|
140
|
-
link: string
|
|
121
|
+
link: string
|
|
141
122
|
}
|
|
142
123
|
|
|
143
124
|
/** Hero section configuration for entry page. */
|
|
144
125
|
export interface JsHeroConfig {
|
|
145
126
|
/** Main title (large, gradient text). */
|
|
146
|
-
name?: string
|
|
127
|
+
name?: string
|
|
147
128
|
/** Secondary text. */
|
|
148
|
-
text?: string
|
|
129
|
+
text?: string
|
|
149
130
|
/** Tagline. */
|
|
150
|
-
tagline?: string
|
|
131
|
+
tagline?: string
|
|
151
132
|
/** Optional notice shown in the hero. */
|
|
152
|
-
notice?: JsHeroNotice
|
|
133
|
+
notice?: JsHeroNotice
|
|
153
134
|
/** Hero image. */
|
|
154
|
-
image?: JsHeroImage
|
|
135
|
+
image?: JsHeroImage
|
|
155
136
|
/** Action buttons. */
|
|
156
|
-
actions?: Array<JsHeroAction
|
|
137
|
+
actions?: Array<JsHeroAction>
|
|
157
138
|
}
|
|
158
139
|
|
|
159
140
|
/** Hero image for entry page. */
|
|
160
141
|
export interface JsHeroImage {
|
|
161
142
|
/** Image source URL. */
|
|
162
|
-
src: string
|
|
143
|
+
src: string
|
|
163
144
|
/** Light mode image source URL. */
|
|
164
|
-
lightSrc?: string
|
|
145
|
+
lightSrc?: string
|
|
165
146
|
/** Dark mode image source URL. */
|
|
166
|
-
darkSrc?: string
|
|
147
|
+
darkSrc?: string
|
|
167
148
|
/** Alt text. */
|
|
168
|
-
alt?: string
|
|
149
|
+
alt?: string
|
|
169
150
|
/** Image width. */
|
|
170
|
-
width?: number
|
|
151
|
+
width?: number
|
|
171
152
|
/** Image height. */
|
|
172
|
-
height?: number
|
|
153
|
+
height?: number
|
|
173
154
|
}
|
|
174
155
|
|
|
175
156
|
/** Hero notice for entry page. */
|
|
176
157
|
export interface JsHeroNotice {
|
|
177
158
|
/** Notice title. */
|
|
178
|
-
title?: string
|
|
159
|
+
title?: string
|
|
179
160
|
/** Notice paragraphs. */
|
|
180
|
-
body?: Array<string
|
|
161
|
+
body?: Array<string>
|
|
181
162
|
}
|
|
182
163
|
|
|
183
164
|
/** Locale information for the locale switcher. */
|
|
184
165
|
export interface JsLocaleInfo {
|
|
185
166
|
/** BCP 47 locale tag. */
|
|
186
|
-
code: string
|
|
167
|
+
code: string
|
|
187
168
|
/** Display name. */
|
|
188
|
-
name: string
|
|
169
|
+
name: string
|
|
189
170
|
/** Text direction. */
|
|
190
|
-
dir: string
|
|
171
|
+
dir: string
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface JsMarkdownLintDiagnostic {
|
|
175
|
+
ruleId: string
|
|
176
|
+
severity: string
|
|
177
|
+
message: string
|
|
178
|
+
line: number
|
|
179
|
+
column: number
|
|
180
|
+
endLine: number
|
|
181
|
+
endColumn: number
|
|
182
|
+
language?: string
|
|
183
|
+
suggestions?: Array<string>
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface JsMarkdownLintDictionaryOptions {
|
|
187
|
+
words?: Array<string>
|
|
188
|
+
byLanguage?: Array<JsMarkdownLintLanguageWords>
|
|
189
|
+
ignoredWords?: Array<string>
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface JsMarkdownLintLanguageWords {
|
|
193
|
+
language: string
|
|
194
|
+
words: Array<string>
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface JsMarkdownLintOptions {
|
|
198
|
+
languages?: Array<string>
|
|
199
|
+
rules?: JsMarkdownLintRuleOptions
|
|
200
|
+
dictionary?: JsMarkdownLintDictionaryOptions
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface JsMarkdownLintResult {
|
|
204
|
+
diagnostics: Array<JsMarkdownLintDiagnostic>
|
|
205
|
+
errorCount: number
|
|
206
|
+
warningCount: number
|
|
207
|
+
infoCount: number
|
|
208
|
+
maskedDocument: string
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface JsMarkdownLintRuleOptions {
|
|
212
|
+
duplicateHeadings?: boolean
|
|
213
|
+
headingIncrement?: boolean
|
|
214
|
+
maxConsecutiveBlankLines?: number
|
|
215
|
+
repeatedPunctuation?: boolean
|
|
216
|
+
repeatedWords?: boolean
|
|
217
|
+
spellcheck?: boolean
|
|
218
|
+
trailingSpaces?: boolean
|
|
191
219
|
}
|
|
192
220
|
|
|
193
221
|
/** OG image configuration for JavaScript. */
|
|
194
222
|
export interface JsOgImageConfig {
|
|
195
223
|
/** Image width in pixels. */
|
|
196
|
-
width?: number
|
|
224
|
+
width?: number
|
|
197
225
|
/** Image height in pixels. */
|
|
198
|
-
height?: number
|
|
226
|
+
height?: number
|
|
199
227
|
/** Background color (hex). */
|
|
200
|
-
backgroundColor?: string
|
|
228
|
+
backgroundColor?: string
|
|
201
229
|
/** Text color (hex). */
|
|
202
|
-
textColor?: string
|
|
230
|
+
textColor?: string
|
|
203
231
|
/** Title font size. */
|
|
204
|
-
titleFontSize?: number
|
|
232
|
+
titleFontSize?: number
|
|
205
233
|
/** Description font size. */
|
|
206
|
-
descriptionFontSize?: number
|
|
234
|
+
descriptionFontSize?: number
|
|
207
235
|
}
|
|
208
236
|
|
|
209
237
|
/** OG image data for JavaScript. */
|
|
210
238
|
export interface JsOgImageData {
|
|
211
239
|
/** Page title. */
|
|
212
|
-
title: string
|
|
240
|
+
title: string
|
|
213
241
|
/** Page description. */
|
|
214
|
-
description?: string
|
|
242
|
+
description?: string
|
|
215
243
|
/** Site name. */
|
|
216
|
-
siteName?: string
|
|
244
|
+
siteName?: string
|
|
217
245
|
/** Author name. */
|
|
218
|
-
author?: string
|
|
246
|
+
author?: string
|
|
219
247
|
}
|
|
220
248
|
|
|
221
249
|
/** Parser options for JavaScript. */
|
|
222
250
|
export interface JsParserOptions {
|
|
223
251
|
/** Enable GFM extensions. */
|
|
224
|
-
gfm?: boolean
|
|
252
|
+
gfm?: boolean
|
|
225
253
|
/** Enable footnotes. */
|
|
226
|
-
footnotes?: boolean
|
|
254
|
+
footnotes?: boolean
|
|
227
255
|
/** Enable task lists. */
|
|
228
|
-
taskLists?: boolean
|
|
256
|
+
taskLists?: boolean
|
|
229
257
|
/** Enable tables. */
|
|
230
|
-
tables?: boolean
|
|
258
|
+
tables?: boolean
|
|
231
259
|
/** Enable strikethrough. */
|
|
232
|
-
strikethrough?: boolean
|
|
260
|
+
strikethrough?: boolean
|
|
233
261
|
/** Enable autolinks. */
|
|
234
|
-
autolinks?: boolean
|
|
262
|
+
autolinks?: boolean
|
|
235
263
|
}
|
|
236
264
|
|
|
237
265
|
/** Search document for JavaScript. */
|
|
238
266
|
export interface JsSearchDocument {
|
|
239
267
|
/** Unique document identifier. */
|
|
240
|
-
id: string
|
|
268
|
+
id: string
|
|
241
269
|
/** Document title. */
|
|
242
|
-
title: string
|
|
270
|
+
title: string
|
|
243
271
|
/** Document URL. */
|
|
244
|
-
url: string
|
|
272
|
+
url: string
|
|
245
273
|
/** Document body text. */
|
|
246
|
-
body: string
|
|
274
|
+
body: string
|
|
247
275
|
/** Document headings. */
|
|
248
|
-
headings: Array<string
|
|
276
|
+
headings: Array<string>
|
|
249
277
|
/** Code snippets. */
|
|
250
|
-
code: Array<string
|
|
278
|
+
code: Array<string>
|
|
251
279
|
}
|
|
252
280
|
|
|
253
281
|
/** Search options for JavaScript. */
|
|
254
282
|
export interface JsSearchOptions {
|
|
255
283
|
/** Maximum number of results. */
|
|
256
|
-
limit?: number
|
|
284
|
+
limit?: number
|
|
257
285
|
/** Enable prefix matching. */
|
|
258
|
-
prefix?: boolean
|
|
286
|
+
prefix?: boolean
|
|
259
287
|
/** Enable fuzzy matching. */
|
|
260
|
-
fuzzy?: boolean
|
|
288
|
+
fuzzy?: boolean
|
|
261
289
|
/** Minimum score threshold. */
|
|
262
|
-
threshold?: number
|
|
290
|
+
threshold?: number
|
|
263
291
|
}
|
|
264
292
|
|
|
265
293
|
/** Search result for JavaScript. */
|
|
266
294
|
export interface JsSearchResult {
|
|
267
295
|
/** Document ID. */
|
|
268
|
-
id: string
|
|
296
|
+
id: string
|
|
269
297
|
/** Document title. */
|
|
270
|
-
title: string
|
|
298
|
+
title: string
|
|
271
299
|
/** Document URL. */
|
|
272
|
-
url: string
|
|
300
|
+
url: string
|
|
273
301
|
/** Relevance score. */
|
|
274
|
-
score: number
|
|
302
|
+
score: number
|
|
275
303
|
/** Matched terms. */
|
|
276
|
-
matches: Array<string
|
|
304
|
+
matches: Array<string>
|
|
277
305
|
/** Content snippet. */
|
|
278
|
-
snippet: string
|
|
306
|
+
snippet: string
|
|
279
307
|
}
|
|
280
308
|
|
|
281
309
|
/** Social links for JavaScript. */
|
|
282
310
|
export interface JsSocialLinks {
|
|
283
311
|
/** GitHub URL. */
|
|
284
|
-
github?: string
|
|
312
|
+
github?: string
|
|
285
313
|
/** Twitter/X URL. */
|
|
286
|
-
twitter?: string
|
|
314
|
+
twitter?: string
|
|
287
315
|
/** Discord URL. */
|
|
288
|
-
discord?: string
|
|
316
|
+
discord?: string
|
|
289
317
|
}
|
|
290
318
|
|
|
291
319
|
/** Source documentation item extracted from a JS/TS file. */
|
|
292
320
|
export interface JsSourceDocItem {
|
|
293
|
-
name: string
|
|
294
|
-
kind: string
|
|
295
|
-
doc?: string
|
|
296
|
-
jsdoc?: string
|
|
297
|
-
sourcePath: string
|
|
298
|
-
line: number
|
|
299
|
-
endLine: number
|
|
300
|
-
exported: boolean
|
|
301
|
-
signature?: string
|
|
302
|
-
params: Array<JsSourceDocParam
|
|
303
|
-
returnType?: string
|
|
304
|
-
tags: Array<JsSourceDocTag
|
|
321
|
+
name: string
|
|
322
|
+
kind: string
|
|
323
|
+
doc?: string
|
|
324
|
+
jsdoc?: string
|
|
325
|
+
sourcePath: string
|
|
326
|
+
line: number
|
|
327
|
+
endLine: number
|
|
328
|
+
exported: boolean
|
|
329
|
+
signature?: string
|
|
330
|
+
params: Array<JsSourceDocParam>
|
|
331
|
+
returnType?: string
|
|
332
|
+
tags: Array<JsSourceDocTag>
|
|
305
333
|
}
|
|
306
334
|
|
|
307
335
|
/** Parameter documentation extracted from source code. */
|
|
308
336
|
export interface JsSourceDocParam {
|
|
309
|
-
name: string
|
|
310
|
-
typeAnnotation?: string
|
|
311
|
-
optional: boolean
|
|
312
|
-
defaultValue?: string
|
|
313
|
-
description?: string
|
|
337
|
+
name: string
|
|
338
|
+
typeAnnotation?: string
|
|
339
|
+
optional: boolean
|
|
340
|
+
defaultValue?: string
|
|
341
|
+
description?: string
|
|
314
342
|
}
|
|
315
343
|
|
|
316
344
|
/** Raw JSDoc tag extracted from source code. */
|
|
317
345
|
export interface JsSourceDocTag {
|
|
318
|
-
tag: string
|
|
319
|
-
value: string
|
|
346
|
+
tag: string
|
|
347
|
+
value: string
|
|
320
348
|
}
|
|
321
349
|
|
|
322
350
|
/** SSG configuration. */
|
|
323
351
|
export interface JsSsgConfig {
|
|
324
352
|
/** Site name. */
|
|
325
|
-
siteName: string
|
|
353
|
+
siteName: string
|
|
326
354
|
/** Base URL path. */
|
|
327
|
-
base: string
|
|
355
|
+
base: string
|
|
328
356
|
/** OG image URL. */
|
|
329
|
-
ogImage?: string
|
|
357
|
+
ogImage?: string
|
|
330
358
|
/** Theme configuration. */
|
|
331
|
-
theme?: JsThemeConfig
|
|
359
|
+
theme?: JsThemeConfig
|
|
332
360
|
/** Current locale for this page. */
|
|
333
|
-
locale?: string
|
|
361
|
+
locale?: string
|
|
334
362
|
/** Available locales for locale switcher. */
|
|
335
|
-
availableLocales?: Array<JsLocaleInfo
|
|
363
|
+
availableLocales?: Array<JsLocaleInfo>
|
|
336
364
|
}
|
|
337
365
|
|
|
338
366
|
/** Navigation group for SSG. */
|
|
339
367
|
export interface JsSsgNavGroup {
|
|
340
368
|
/** Group title. */
|
|
341
|
-
title: string
|
|
369
|
+
title: string
|
|
342
370
|
/** Navigation items. */
|
|
343
|
-
items: Array<JsSsgNavItem
|
|
371
|
+
items: Array<JsSsgNavItem>
|
|
344
372
|
}
|
|
345
373
|
|
|
346
374
|
/** Navigation item for SSG. */
|
|
347
375
|
export interface JsSsgNavItem {
|
|
348
376
|
/** Display title. */
|
|
349
|
-
title: string
|
|
377
|
+
title: string
|
|
350
378
|
/** URL path. */
|
|
351
|
-
path: string
|
|
379
|
+
path: string
|
|
352
380
|
/** Full href. */
|
|
353
|
-
href: string
|
|
381
|
+
href: string
|
|
354
382
|
}
|
|
355
383
|
|
|
356
384
|
/** Page data for SSG. */
|
|
357
385
|
export interface JsSsgPageData {
|
|
358
386
|
/** Page title. */
|
|
359
|
-
title: string
|
|
387
|
+
title: string
|
|
360
388
|
/** Page description. */
|
|
361
|
-
description?: string
|
|
389
|
+
description?: string
|
|
362
390
|
/** Page content HTML. */
|
|
363
|
-
content: string
|
|
391
|
+
content: string
|
|
364
392
|
/** Table of contents entries. */
|
|
365
|
-
toc: Array<TocEntry
|
|
393
|
+
toc: Array<TocEntry>
|
|
366
394
|
/** URL path. */
|
|
367
|
-
path: string
|
|
395
|
+
path: string
|
|
368
396
|
/** Entry page configuration (if layout: entry). */
|
|
369
|
-
entryPage?: JsEntryPageConfig
|
|
397
|
+
entryPage?: JsEntryPageConfig
|
|
370
398
|
}
|
|
371
399
|
|
|
372
400
|
/** Theme colors for JavaScript. */
|
|
373
401
|
export interface JsThemeColors {
|
|
374
402
|
/** Primary accent color. */
|
|
375
|
-
primary?: string
|
|
403
|
+
primary?: string
|
|
376
404
|
/** Primary color on hover. */
|
|
377
|
-
primaryHover?: string
|
|
405
|
+
primaryHover?: string
|
|
378
406
|
/** Background color. */
|
|
379
|
-
background?: string
|
|
407
|
+
background?: string
|
|
380
408
|
/** Alternative background color. */
|
|
381
|
-
backgroundAlt?: string
|
|
409
|
+
backgroundAlt?: string
|
|
382
410
|
/** Main text color. */
|
|
383
|
-
text?: string
|
|
411
|
+
text?: string
|
|
384
412
|
/** Muted text color. */
|
|
385
|
-
textMuted?: string
|
|
413
|
+
textMuted?: string
|
|
386
414
|
/** Border color. */
|
|
387
|
-
border?: string
|
|
415
|
+
border?: string
|
|
388
416
|
/** Code block background color. */
|
|
389
|
-
codeBackground?: string
|
|
417
|
+
codeBackground?: string
|
|
390
418
|
/** Code block text color. */
|
|
391
|
-
codeText?: string
|
|
419
|
+
codeText?: string
|
|
392
420
|
}
|
|
393
421
|
|
|
394
422
|
/** Theme configuration for JavaScript. */
|
|
395
423
|
export interface JsThemeConfig {
|
|
396
424
|
/** Light mode colors. */
|
|
397
|
-
colors?: JsThemeColors
|
|
425
|
+
colors?: JsThemeColors
|
|
398
426
|
/** Dark mode colors. */
|
|
399
|
-
darkColors?: JsThemeColors
|
|
427
|
+
darkColors?: JsThemeColors
|
|
400
428
|
/** Font configuration. */
|
|
401
|
-
fonts?: JsThemeFonts
|
|
429
|
+
fonts?: JsThemeFonts
|
|
402
430
|
/** Entry page configuration. */
|
|
403
|
-
entryPage?: JsThemeEntryPage
|
|
431
|
+
entryPage?: JsThemeEntryPage
|
|
404
432
|
/** Layout configuration. */
|
|
405
|
-
layout?: JsThemeLayout
|
|
433
|
+
layout?: JsThemeLayout
|
|
406
434
|
/** Header configuration. */
|
|
407
|
-
header?: JsThemeHeader
|
|
435
|
+
header?: JsThemeHeader
|
|
408
436
|
/** Footer configuration. */
|
|
409
|
-
footer?: JsThemeFooter
|
|
437
|
+
footer?: JsThemeFooter
|
|
410
438
|
/** Social links configuration. */
|
|
411
|
-
socialLinks?: JsSocialLinks
|
|
439
|
+
socialLinks?: JsSocialLinks
|
|
412
440
|
/** Embedded HTML content at specific positions. */
|
|
413
|
-
embed?: JsThemeEmbed
|
|
441
|
+
embed?: JsThemeEmbed
|
|
414
442
|
/** Additional custom CSS. */
|
|
415
|
-
css?: string
|
|
443
|
+
css?: string
|
|
416
444
|
/** Additional custom JavaScript. */
|
|
417
|
-
js?: string
|
|
445
|
+
js?: string
|
|
418
446
|
}
|
|
419
447
|
|
|
420
448
|
/** Embedded HTML content for specific positions. */
|
|
421
449
|
export interface JsThemeEmbed {
|
|
422
450
|
/** Content to embed into `<head>`. */
|
|
423
|
-
head?: string
|
|
451
|
+
head?: string
|
|
424
452
|
/** Content before header. */
|
|
425
|
-
headerBefore?: string
|
|
453
|
+
headerBefore?: string
|
|
426
454
|
/** Content after header. */
|
|
427
|
-
headerAfter?: string
|
|
455
|
+
headerAfter?: string
|
|
428
456
|
/** Content before sidebar navigation. */
|
|
429
|
-
sidebarBefore?: string
|
|
457
|
+
sidebarBefore?: string
|
|
430
458
|
/** Content after sidebar navigation. */
|
|
431
|
-
sidebarAfter?: string
|
|
459
|
+
sidebarAfter?: string
|
|
432
460
|
/** Content before main content. */
|
|
433
|
-
contentBefore?: string
|
|
461
|
+
contentBefore?: string
|
|
434
462
|
/** Content after main content. */
|
|
435
|
-
contentAfter?: string
|
|
463
|
+
contentAfter?: string
|
|
436
464
|
/** Content before footer. */
|
|
437
|
-
footerBefore?: string
|
|
465
|
+
footerBefore?: string
|
|
438
466
|
/** Custom footer content. */
|
|
439
|
-
footer?: string
|
|
467
|
+
footer?: string
|
|
440
468
|
}
|
|
441
469
|
|
|
442
470
|
/** Entry page theme configuration for JavaScript. */
|
|
443
471
|
export interface JsThemeEntryPage {
|
|
444
472
|
/** Landing page presentation mode. */
|
|
445
|
-
mode?: string
|
|
473
|
+
mode?: string
|
|
446
474
|
}
|
|
447
475
|
|
|
448
476
|
/** Theme fonts for JavaScript. */
|
|
449
477
|
export interface JsThemeFonts {
|
|
450
478
|
/** Sans-serif font stack. */
|
|
451
|
-
sans?: string
|
|
479
|
+
sans?: string
|
|
452
480
|
/** Monospace font stack. */
|
|
453
|
-
mono?: string
|
|
481
|
+
mono?: string
|
|
454
482
|
}
|
|
455
483
|
|
|
456
484
|
/** Theme footer for JavaScript. */
|
|
457
485
|
export interface JsThemeFooter {
|
|
458
486
|
/** Footer message (supports HTML). */
|
|
459
|
-
message?: string
|
|
487
|
+
message?: string
|
|
460
488
|
/** Copyright text (supports HTML). */
|
|
461
|
-
copyright?: string
|
|
489
|
+
copyright?: string
|
|
462
490
|
}
|
|
463
491
|
|
|
464
492
|
/** Theme header for JavaScript. */
|
|
465
493
|
export interface JsThemeHeader {
|
|
466
494
|
/** Logo image URL. */
|
|
467
|
-
logo?: string
|
|
495
|
+
logo?: string
|
|
468
496
|
/** Light mode logo image URL. */
|
|
469
|
-
logoLight?: string
|
|
497
|
+
logoLight?: string
|
|
470
498
|
/** Dark mode logo image URL. */
|
|
471
|
-
logoDark?: string
|
|
499
|
+
logoDark?: string
|
|
472
500
|
/** Whether to render the site name text next to the logo. */
|
|
473
|
-
showSiteNameText?: boolean
|
|
501
|
+
showSiteNameText?: boolean
|
|
474
502
|
/** Logo width in pixels. */
|
|
475
|
-
logoWidth?: number
|
|
503
|
+
logoWidth?: number
|
|
476
504
|
/** Logo height in pixels. */
|
|
477
|
-
logoHeight?: number
|
|
505
|
+
logoHeight?: number
|
|
478
506
|
}
|
|
479
507
|
|
|
480
508
|
/** Theme layout for JavaScript. */
|
|
481
509
|
export interface JsThemeLayout {
|
|
482
510
|
/** Sidebar width (CSS value). */
|
|
483
|
-
sidebarWidth?: string
|
|
511
|
+
sidebarWidth?: string
|
|
484
512
|
/** Header height (CSS value). */
|
|
485
|
-
headerHeight?: string
|
|
513
|
+
headerHeight?: string
|
|
486
514
|
/** Maximum content width (CSS value). */
|
|
487
|
-
maxContentWidth?: string
|
|
515
|
+
maxContentWidth?: string
|
|
488
516
|
}
|
|
489
517
|
|
|
490
518
|
/** Transform options for JavaScript. */
|
|
491
519
|
export interface JsTransformOptions {
|
|
492
520
|
/** Enable GFM extensions. */
|
|
493
|
-
gfm?: boolean
|
|
521
|
+
gfm?: boolean
|
|
494
522
|
/** Enable footnotes. */
|
|
495
|
-
footnotes?: boolean
|
|
523
|
+
footnotes?: boolean
|
|
496
524
|
/** Enable task lists. */
|
|
497
|
-
taskLists?: boolean
|
|
525
|
+
taskLists?: boolean
|
|
498
526
|
/** Enable tables. */
|
|
499
|
-
tables?: boolean
|
|
527
|
+
tables?: boolean
|
|
500
528
|
/** Enable strikethrough. */
|
|
501
|
-
strikethrough?: boolean
|
|
529
|
+
strikethrough?: boolean
|
|
502
530
|
/** Enable autolinks. */
|
|
503
|
-
autolinks?: boolean
|
|
531
|
+
autolinks?: boolean
|
|
504
532
|
/** Maximum TOC depth (1-6). */
|
|
505
|
-
tocMaxDepth?: number
|
|
533
|
+
tocMaxDepth?: number
|
|
506
534
|
/** Convert `.md` links to `.html` links for SSG output. */
|
|
507
|
-
convertMdLinks?: boolean
|
|
535
|
+
convertMdLinks?: boolean
|
|
508
536
|
/** Base URL for absolute link conversion (e.g., "/" or "/docs/"). */
|
|
509
|
-
baseUrl?: string
|
|
537
|
+
baseUrl?: string
|
|
510
538
|
/** Source file path for relative link resolution. */
|
|
511
|
-
sourcePath?: string
|
|
539
|
+
sourcePath?: string
|
|
512
540
|
/** Enable line annotations for code blocks using fence meta. */
|
|
513
|
-
codeAnnotations?: boolean
|
|
541
|
+
codeAnnotations?: boolean
|
|
514
542
|
/** Fence meta key used to read code annotations. */
|
|
515
|
-
codeAnnotationMetaKey?: string
|
|
543
|
+
codeAnnotationMetaKey?: string
|
|
516
544
|
/** Code annotation syntax mode. */
|
|
517
|
-
codeAnnotationSyntax?: string
|
|
545
|
+
codeAnnotationSyntax?: string
|
|
518
546
|
/** Enable line numbers for all code blocks by default. */
|
|
519
|
-
codeAnnotationDefaultLineNumbers?: boolean
|
|
547
|
+
codeAnnotationDefaultLineNumbers?: boolean
|
|
520
548
|
}
|
|
521
549
|
|
|
550
|
+
export declare function lintMarkdown(source: string, options?: JsMarkdownLintOptions | undefined | null): JsMarkdownLintResult
|
|
551
|
+
|
|
552
|
+
export declare function lintMarkdownDocuments(sources: Array<string>, options?: JsMarkdownLintOptions | undefined | null): Array<JsMarkdownLintResult>
|
|
553
|
+
|
|
522
554
|
/**
|
|
523
555
|
* Loads dictionaries from the given directory.
|
|
524
556
|
*
|
|
525
557
|
* The directory should contain locale subdirectories (e.g., `en/`, `ja/`)
|
|
526
558
|
* with JSON or YAML translation files.
|
|
527
559
|
*/
|
|
528
|
-
export declare function loadDictionaries(dir: string): I18NLoadResult
|
|
560
|
+
export declare function loadDictionaries(dir: string): I18NLoadResult
|
|
529
561
|
|
|
530
562
|
/**
|
|
531
563
|
* Loads dictionaries from the given directory and returns a flat key-value map per locale.
|
|
@@ -533,30 +565,27 @@ export declare function loadDictionaries(dir: string): I18NLoadResult;
|
|
|
533
565
|
* Each locale maps to a flat `{ "namespace.key": "value" }` structure.
|
|
534
566
|
* Supports both JSON and YAML dictionary files.
|
|
535
567
|
*/
|
|
536
|
-
export declare function loadDictionariesFlat(dir: string): Record<string, Record<string, string
|
|
568
|
+
export declare function loadDictionariesFlat(dir: string): Record<string, Record<string, string>>
|
|
537
569
|
|
|
538
570
|
/** Restores code block metadata after JavaScript-side syntax highlighting. */
|
|
539
|
-
export declare function mergeHighlightedCodeBlocks(
|
|
540
|
-
originalHtml: string,
|
|
541
|
-
highlightedHtml: string,
|
|
542
|
-
): string;
|
|
571
|
+
export declare function mergeHighlightedCodeBlocks(originalHtml: string, highlightedHtml: string): string
|
|
543
572
|
|
|
544
573
|
/** Mermaid transform result. */
|
|
545
574
|
export interface MermaidTransformResult {
|
|
546
575
|
/** The transformed HTML with mermaid code blocks replaced by rendered SVGs. */
|
|
547
|
-
html: string
|
|
576
|
+
html: string
|
|
548
577
|
/** Non-fatal errors encountered during rendering (per-diagram). */
|
|
549
|
-
errors: Array<string
|
|
578
|
+
errors: Array<string>
|
|
550
579
|
}
|
|
551
580
|
|
|
552
581
|
/** Result of MF2 validation. */
|
|
553
582
|
export interface Mf2ValidateResult {
|
|
554
583
|
/** Whether the message is valid. */
|
|
555
|
-
valid: boolean
|
|
584
|
+
valid: boolean
|
|
556
585
|
/** Validation errors. */
|
|
557
|
-
errors: Array<string
|
|
586
|
+
errors: Array<string>
|
|
558
587
|
/** AST as JSON (if parsing succeeded). */
|
|
559
|
-
astJson?: string
|
|
588
|
+
astJson?: string
|
|
560
589
|
}
|
|
561
590
|
|
|
562
591
|
/**
|
|
@@ -564,40 +593,31 @@ export interface Mf2ValidateResult {
|
|
|
564
593
|
*
|
|
565
594
|
* Returns the AST as a JSON string for zero-copy transfer to JavaScript.
|
|
566
595
|
*/
|
|
567
|
-
export declare function parse(
|
|
568
|
-
source: string,
|
|
569
|
-
options?: JsParserOptions | undefined | null,
|
|
570
|
-
): ParseResult;
|
|
596
|
+
export declare function parse(source: string, options?: JsParserOptions | undefined | null): ParseResult
|
|
571
597
|
|
|
572
598
|
/** Parses Markdown and renders to HTML. */
|
|
573
|
-
export declare function parseAndRender(
|
|
574
|
-
source: string,
|
|
575
|
-
options?: JsParserOptions | undefined | null,
|
|
576
|
-
): RenderResult;
|
|
599
|
+
export declare function parseAndRender(source: string, options?: JsParserOptions | undefined | null): RenderResult
|
|
577
600
|
|
|
578
601
|
/** Parses Markdown and renders to HTML asynchronously (runs on worker thread). */
|
|
579
|
-
export declare function parseAndRenderAsync(
|
|
580
|
-
source: string,
|
|
581
|
-
options?: JsParserOptions | undefined | null,
|
|
582
|
-
): Promise<unknown>;
|
|
602
|
+
export declare function parseAndRenderAsync(source: string, options?: JsParserOptions | undefined | null): Promise<unknown>
|
|
583
603
|
|
|
584
604
|
/** Parse result containing the AST as JSON. */
|
|
585
605
|
export interface ParseResult {
|
|
586
606
|
/** The AST as a JSON string. */
|
|
587
|
-
ast: string
|
|
607
|
+
ast: string
|
|
588
608
|
/** Parse errors, if any. */
|
|
589
|
-
errors: Array<string
|
|
609
|
+
errors: Array<string>
|
|
590
610
|
}
|
|
591
611
|
|
|
592
612
|
/** Renders an AST (provided as JSON) to HTML. */
|
|
593
|
-
export declare function render(astJson: string): RenderResult
|
|
613
|
+
export declare function render(astJson: string): RenderResult
|
|
594
614
|
|
|
595
615
|
/** Render result containing the HTML output. */
|
|
596
616
|
export interface RenderResult {
|
|
597
617
|
/** The rendered HTML. */
|
|
598
|
-
html: string
|
|
618
|
+
html: string
|
|
599
619
|
/** Render errors, if any. */
|
|
600
|
-
errors: Array<string
|
|
620
|
+
errors: Array<string>
|
|
601
621
|
}
|
|
602
622
|
|
|
603
623
|
/**
|
|
@@ -606,20 +626,16 @@ export interface RenderResult {
|
|
|
606
626
|
* Takes a JSON-serialized index, query string, and options.
|
|
607
627
|
* Returns an array of search results.
|
|
608
628
|
*/
|
|
609
|
-
export declare function searchIndex(
|
|
610
|
-
indexJson: string,
|
|
611
|
-
query: string,
|
|
612
|
-
options?: JsSearchOptions | undefined | null,
|
|
613
|
-
): Array<JsSearchResult>;
|
|
629
|
+
export declare function searchIndex(indexJson: string, query: string, options?: JsSearchOptions | undefined | null): Array<JsSearchResult>
|
|
614
630
|
|
|
615
631
|
/** Table of contents entry. */
|
|
616
632
|
export interface TocEntry {
|
|
617
633
|
/** Heading depth (1-6). */
|
|
618
|
-
depth: number
|
|
634
|
+
depth: number
|
|
619
635
|
/** Heading text. */
|
|
620
|
-
text: string
|
|
636
|
+
text: string
|
|
621
637
|
/** URL-friendly slug. */
|
|
622
|
-
slug: string
|
|
638
|
+
slug: string
|
|
623
639
|
}
|
|
624
640
|
|
|
625
641
|
/**
|
|
@@ -627,16 +643,10 @@ export interface TocEntry {
|
|
|
627
643
|
*
|
|
628
644
|
* This is the main entry point for @ox-content/unplugin.
|
|
629
645
|
*/
|
|
630
|
-
export declare function transform(
|
|
631
|
-
source: string,
|
|
632
|
-
options?: JsTransformOptions | undefined | null,
|
|
633
|
-
): TransformResult;
|
|
646
|
+
export declare function transform(source: string, options?: JsTransformOptions | undefined | null): TransformResult
|
|
634
647
|
|
|
635
648
|
/** Transforms Markdown source asynchronously (runs on worker thread). */
|
|
636
|
-
export declare function transformAsync(
|
|
637
|
-
source: string,
|
|
638
|
-
options?: JsTransformOptions | undefined | null,
|
|
639
|
-
): Promise<unknown>;
|
|
649
|
+
export declare function transformAsync(source: string, options?: JsTransformOptions | undefined | null): Promise<unknown>
|
|
640
650
|
|
|
641
651
|
/**
|
|
642
652
|
* Transforms mermaid code blocks in HTML to rendered SVG diagrams.
|
|
@@ -645,18 +655,18 @@ export declare function transformAsync(
|
|
|
645
655
|
* renders each in parallel using the mmdc CLI, and replaces them with
|
|
646
656
|
* `<div class="ox-mermaid">...</div>`.
|
|
647
657
|
*/
|
|
648
|
-
export declare function transformMermaid(html: string, mmdcPath: string): MermaidTransformResult
|
|
658
|
+
export declare function transformMermaid(html: string, mmdcPath: string): MermaidTransformResult
|
|
649
659
|
|
|
650
660
|
/** Transform result containing HTML, frontmatter, and TOC. */
|
|
651
661
|
export interface TransformResult {
|
|
652
662
|
/** The rendered HTML. */
|
|
653
|
-
html: string
|
|
663
|
+
html: string
|
|
654
664
|
/** Parsed frontmatter as JSON string. */
|
|
655
|
-
frontmatter: string
|
|
665
|
+
frontmatter: string
|
|
656
666
|
/** Table of contents entries. */
|
|
657
|
-
toc: Array<TocEntry
|
|
667
|
+
toc: Array<TocEntry>
|
|
658
668
|
/** Parse/render errors, if any. */
|
|
659
|
-
errors: Array<string
|
|
669
|
+
errors: Array<string>
|
|
660
670
|
}
|
|
661
671
|
|
|
662
672
|
/**
|
|
@@ -664,7 +674,7 @@ export interface TransformResult {
|
|
|
664
674
|
*
|
|
665
675
|
* Returns parsing and semantic validation results.
|
|
666
676
|
*/
|
|
667
|
-
export declare function validateMf2(message: string): Mf2ValidateResult
|
|
677
|
+
export declare function validateMf2(message: string): Mf2ValidateResult
|
|
668
678
|
|
|
669
679
|
/** Returns the version of ox_content_napi. */
|
|
670
|
-
export declare function version(): string
|
|
680
|
+
export declare function version(): string
|
package/index.js
CHANGED
|
@@ -72,6 +72,8 @@ module.exports = binding;
|
|
|
72
72
|
module.exports.parse = binding.parse;
|
|
73
73
|
module.exports.parseAndRender = binding.parseAndRender;
|
|
74
74
|
module.exports.parseAndRenderAsync = binding.parseAndRenderAsync;
|
|
75
|
+
module.exports.lintMarkdown = binding.lintMarkdown;
|
|
76
|
+
module.exports.lintMarkdownDocuments = binding.lintMarkdownDocuments;
|
|
75
77
|
module.exports.render = binding.render;
|
|
76
78
|
module.exports.transform = binding.transform;
|
|
77
79
|
module.exports.transformAsync = binding.transformAsync;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox-content/napi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Node.js bindings for Ox Content - High-performance Markdown parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"@ox-content/binding-darwin-x64": "2.
|
|
49
|
-
"@ox-content/binding-darwin-arm64": "2.
|
|
50
|
-
"@ox-content/binding-linux-x64-gnu": "2.
|
|
51
|
-
"@ox-content/binding-linux-arm64-gnu": "2.
|
|
52
|
-
"@ox-content/binding-win32-x64-msvc": "2.
|
|
48
|
+
"@ox-content/binding-darwin-x64": "2.5.0",
|
|
49
|
+
"@ox-content/binding-darwin-arm64": "2.5.0",
|
|
50
|
+
"@ox-content/binding-linux-x64-gnu": "2.5.0",
|
|
51
|
+
"@ox-content/binding-linux-arm64-gnu": "2.5.0",
|
|
52
|
+
"@ox-content/binding-win32-x64-msvc": "2.5.0"
|
|
53
53
|
}
|
|
54
54
|
}
|