@ox-content/napi 2.30.0 → 2.32.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 +149 -0
- package/package.json +6 -6
package/index.d.ts
CHANGED
|
@@ -54,12 +54,18 @@ export declare function collectSsgMarkdownFiles(srcDir: string, extensions: Arra
|
|
|
54
54
|
/** Extracts shared CSS and JavaScript assets from generated SSG pages. */
|
|
55
55
|
export declare function externalizeSsgAssets(pages: Array<JsSsgGeneratedHtmlPage>, outDir: string, base: string): JsSsgExternalizedAssets
|
|
56
56
|
|
|
57
|
+
/** Extract fenced code blocks from Markdown. */
|
|
58
|
+
export declare function extractCodeBlocks(source: string): Array<JsCodeBlock>
|
|
59
|
+
|
|
57
60
|
/** Extracts normalized documentation entries from source directories using Oxc. */
|
|
58
61
|
export declare function extractDocsFromDirectories(srcDirs: Array<string>, include: Array<string>, exclude: Array<string>, includePrivate?: boolean | undefined | null, includeInternal?: boolean | undefined | null): Array<JsExtractedDocsModule>
|
|
59
62
|
|
|
60
63
|
/** Extracts generated API docs grouped by public entry points. */
|
|
61
64
|
export declare function extractDocsFromEntryPoints(entryPoints: Array<JsEntryPointSpec>, options?: JsEntryPointDocsOptions | undefined | null): Array<JsEntrypointDocsModule>
|
|
62
65
|
|
|
66
|
+
/** Extract runnable documentation examples for Vitest harness generation. */
|
|
67
|
+
export declare function extractDocsTests(source: string, options?: JsDocsTestOptions | undefined | null): Array<JsCodeBlock>
|
|
68
|
+
|
|
63
69
|
/** Extracts normalized documentation entries from a JavaScript/TypeScript file using Oxc. */
|
|
64
70
|
export declare function extractFileDocEntries(filePath: string, includePrivate?: boolean | undefined | null, includeInternal?: boolean | undefined | null): Array<JsDocEntry>
|
|
65
71
|
|
|
@@ -193,6 +199,53 @@ export interface I18NLoadResult {
|
|
|
193
199
|
errors: Array<string>
|
|
194
200
|
}
|
|
195
201
|
|
|
202
|
+
/** Attribute syntax transform options. */
|
|
203
|
+
export interface JsAttrsOptions {
|
|
204
|
+
/** Enable markdown-it-attrs style `{#id .class key=value}`. */
|
|
205
|
+
enabled?: boolean
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Extracted fenced code block. */
|
|
209
|
+
export interface JsCodeBlock {
|
|
210
|
+
language: string
|
|
211
|
+
meta: string
|
|
212
|
+
code: string
|
|
213
|
+
startLine: number
|
|
214
|
+
endLine: number
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Diagnostic emitted by code block linting. */
|
|
218
|
+
export interface JsCodeBlockDiagnostic {
|
|
219
|
+
ruleId: string
|
|
220
|
+
severity: string
|
|
221
|
+
message: string
|
|
222
|
+
line: number
|
|
223
|
+
column: number
|
|
224
|
+
endLine: number
|
|
225
|
+
endColumn: number
|
|
226
|
+
language?: string
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Code block linting options. */
|
|
230
|
+
export interface JsCodeBlockLintOptions {
|
|
231
|
+
/** Enable code block linting. */
|
|
232
|
+
enabled?: boolean
|
|
233
|
+
/** Restrict linting to these language identifiers. */
|
|
234
|
+
languages?: Array<string>
|
|
235
|
+
/** Report fences without a language identifier. */
|
|
236
|
+
requireLanguage?: boolean
|
|
237
|
+
/** Report trailing whitespace in code block lines. */
|
|
238
|
+
trailingSpaces?: boolean
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Code import / snippet injection options. */
|
|
242
|
+
export interface JsCodeImportOptions {
|
|
243
|
+
/** Enable `<<< path{selector}` snippet injection. */
|
|
244
|
+
enabled?: boolean
|
|
245
|
+
/** Root directory used for `@/` and absolute snippet imports. */
|
|
246
|
+
rootDir?: string
|
|
247
|
+
}
|
|
248
|
+
|
|
196
249
|
/** Normalized documentation entry used by generated API docs. */
|
|
197
250
|
export interface JsDocEntry {
|
|
198
251
|
name: string
|
|
@@ -273,6 +326,8 @@ export interface JsDocsMarkdownEntry {
|
|
|
273
326
|
/** Extracted docs for one source file used by generated API Markdown. */
|
|
274
327
|
export interface JsDocsMarkdownModule {
|
|
275
328
|
file: string
|
|
329
|
+
/** Module-level description from the entry file's `@module` / leading JSDoc. */
|
|
330
|
+
description?: string
|
|
276
331
|
entries: Array<JsDocsMarkdownEntry>
|
|
277
332
|
}
|
|
278
333
|
|
|
@@ -314,6 +369,38 @@ export interface JsDocsOutputOptions {
|
|
|
314
369
|
pathStrategy?: 'flat' | 'typedoc'
|
|
315
370
|
}
|
|
316
371
|
|
|
372
|
+
/** Docs-as-tests extraction options. */
|
|
373
|
+
export interface JsDocsTestOptions {
|
|
374
|
+
/** Enable docs test extraction. */
|
|
375
|
+
enabled?: boolean
|
|
376
|
+
/** Languages that can be emitted as test cases. */
|
|
377
|
+
languages?: Array<string>
|
|
378
|
+
/** Require fence meta such as `test`, `runnable`, or `vitest`. */
|
|
379
|
+
requireMeta?: boolean
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** Edit-this-page link options. */
|
|
383
|
+
export interface JsEditThisPageOptions {
|
|
384
|
+
/** Enable edit link generation. */
|
|
385
|
+
enabled?: boolean
|
|
386
|
+
/** GitHub repository URL, e.g. `https://github.com/owner/repo`. */
|
|
387
|
+
repoUrl?: string
|
|
388
|
+
/** Branch used in edit URLs. */
|
|
389
|
+
branch?: string
|
|
390
|
+
/** Root directory used to relativize `sourcePath`. */
|
|
391
|
+
rootDir?: string
|
|
392
|
+
/** Link label. */
|
|
393
|
+
label?: string
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** Emoji-shortcode transform options. */
|
|
397
|
+
export interface JsEmojiShortcodeOptions {
|
|
398
|
+
/** Enable `:shortcode:` expansion. */
|
|
399
|
+
enabled?: boolean
|
|
400
|
+
/** Custom shortcode map. Values are emitted verbatim. */
|
|
401
|
+
custom?: Record<string, string>
|
|
402
|
+
}
|
|
403
|
+
|
|
317
404
|
/** Entry page configuration. */
|
|
318
405
|
export interface JsEntryPageConfig {
|
|
319
406
|
/** Hero section. */
|
|
@@ -327,6 +414,8 @@ export interface JsEntrypointDocsModule {
|
|
|
327
414
|
name: string
|
|
328
415
|
file: string
|
|
329
416
|
sourcePath: string
|
|
417
|
+
/** Module-level description from the entry file's `@module` / leading JSDoc. */
|
|
418
|
+
description: string
|
|
330
419
|
entries: Array<JsDocEntry>
|
|
331
420
|
exports: Array<JsPublicExport>
|
|
332
421
|
diagnostics: Array<JsDocsDiagnostic>
|
|
@@ -532,6 +621,20 @@ export interface JsMarkdownLintRuleOptions {
|
|
|
532
621
|
trailingSpaces?: boolean
|
|
533
622
|
}
|
|
534
623
|
|
|
624
|
+
/** Built-in media embed transform switches. */
|
|
625
|
+
export interface JsMediaEmbedsOptions {
|
|
626
|
+
/** Render `<Spotify>` embeds. */
|
|
627
|
+
spotify?: boolean
|
|
628
|
+
/** Render `<StackBlitz>` embeds. */
|
|
629
|
+
stackBlitz?: boolean
|
|
630
|
+
/** Render `<Tweet>` / `<XPost>` static cards. */
|
|
631
|
+
twitter?: boolean
|
|
632
|
+
/** Render `<Bluesky>` static cards. */
|
|
633
|
+
bluesky?: boolean
|
|
634
|
+
/** Render `<WebContainer>` lazy placeholder blocks. */
|
|
635
|
+
webContainer?: boolean
|
|
636
|
+
}
|
|
637
|
+
|
|
535
638
|
/** OG image configuration for JavaScript. */
|
|
536
639
|
export interface JsOgImageConfig {
|
|
537
640
|
/** Image width in pixels. */
|
|
@@ -612,6 +715,18 @@ export interface JsResolvedModule {
|
|
|
612
715
|
exports: Array<JsPublicExport>
|
|
613
716
|
}
|
|
614
717
|
|
|
718
|
+
/** HTML sanitizer options. */
|
|
719
|
+
export interface JsSanitizeOptions {
|
|
720
|
+
/** Enable sanitizer. When omitted, passing this object enables it. */
|
|
721
|
+
enabled?: boolean
|
|
722
|
+
/** Allowed tag names. Omit for safe defaults. */
|
|
723
|
+
allowedTags?: Array<string>
|
|
724
|
+
/** Allowed attribute names. Omit for safe defaults. */
|
|
725
|
+
allowedAttributes?: Array<string>
|
|
726
|
+
/** Allowed URL schemes for href/src/action attributes. Omit for safe defaults. */
|
|
727
|
+
allowedUrlSchemes?: Array<string>
|
|
728
|
+
}
|
|
729
|
+
|
|
615
730
|
/** Search query split into free text and scope prefixes. */
|
|
616
731
|
export interface JsScopedSearchQuery {
|
|
617
732
|
/** Free-text terms after removing scope prefixes. */
|
|
@@ -1051,6 +1166,31 @@ export interface JsTransformOptions {
|
|
|
1051
1166
|
* Defaults to true; ignored when [`Self::autolink_urls`] is off.
|
|
1052
1167
|
*/
|
|
1053
1168
|
autolinkTargetBlank?: boolean
|
|
1169
|
+
/** Opt-in Obsidian-style wiki links. */
|
|
1170
|
+
wikiLinks?: JsWikiLinkOptions
|
|
1171
|
+
/** Opt-in emoji shortcode expansion. */
|
|
1172
|
+
emojiShortcodes?: JsEmojiShortcodeOptions
|
|
1173
|
+
/** Opt-in markdown-it-attrs style attributes. */
|
|
1174
|
+
attributes?: JsAttrsOptions
|
|
1175
|
+
/**
|
|
1176
|
+
* Opt-in CJK emphasis compatibility flag. The parser is already CJK-friendly;
|
|
1177
|
+
* this keeps the feature explicit in the public API.
|
|
1178
|
+
*/
|
|
1179
|
+
cjkEmphasis?: boolean
|
|
1180
|
+
/** Opt-in VitePress-style code import/snippet injection. */
|
|
1181
|
+
codeImports?: JsCodeImportOptions
|
|
1182
|
+
/** Opt-in HTML sanitizer. */
|
|
1183
|
+
sanitize?: JsSanitizeOptions
|
|
1184
|
+
/** Opt-in edit-this-page link generation. */
|
|
1185
|
+
editThisPage?: JsEditThisPageOptions
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
/** Wiki-link transform options. */
|
|
1189
|
+
export interface JsWikiLinkOptions {
|
|
1190
|
+
/** Enable `[[target]]` and `[[target|label]]` expansion. */
|
|
1191
|
+
enabled?: boolean
|
|
1192
|
+
/** Base URL used for site-relative wiki links. */
|
|
1193
|
+
baseUrl?: string
|
|
1054
1194
|
}
|
|
1055
1195
|
|
|
1056
1196
|
/**
|
|
@@ -1068,6 +1208,9 @@ export interface JsYouTubeOptions {
|
|
|
1068
1208
|
lazyLoad?: boolean
|
|
1069
1209
|
}
|
|
1070
1210
|
|
|
1211
|
+
/** Lint fenced code blocks in Markdown. */
|
|
1212
|
+
export declare function lintCodeBlocks(source: string, options?: JsCodeBlockLintOptions | undefined | null): Array<JsCodeBlockDiagnostic>
|
|
1213
|
+
|
|
1071
1214
|
export declare function lintMarkdown(source: string, options?: JsMarkdownLintOptions | undefined | null): JsMarkdownLintResult
|
|
1072
1215
|
|
|
1073
1216
|
export declare function lintMarkdownDocuments(sources: Array<string>, options?: JsMarkdownLintOptions | undefined | null): Array<JsMarkdownLintResult>
|
|
@@ -1188,6 +1331,9 @@ export declare function resolveSsgNavigationGroups(navigation: Array<JsSsgNaviga
|
|
|
1188
1331
|
/** Resolves all output and public route paths for an SSG page. */
|
|
1189
1332
|
export declare function resolveSsgRoutePaths(inputPath: string, srcDir: string, outDir: string, base: string, extension: string, siteUrl?: string | undefined | null): JsSsgRoutePaths
|
|
1190
1333
|
|
|
1334
|
+
/** Sanitize an HTML string with safe defaults or an explicit allow-list. */
|
|
1335
|
+
export declare function sanitizeHtml(html: string, options?: JsSanitizeOptions | undefined | null): string
|
|
1336
|
+
|
|
1191
1337
|
/**
|
|
1192
1338
|
* Searches a serialized index.
|
|
1193
1339
|
*
|
|
@@ -1226,6 +1372,9 @@ export declare function transformAsync(source: string, options?: JsTransformOpti
|
|
|
1226
1372
|
*/
|
|
1227
1373
|
export declare function transformMdastRaw(source: string, options?: JsTransformOptions | undefined | null): Uint8Array
|
|
1228
1374
|
|
|
1375
|
+
/** Transform opt-in static media embed components in already-rendered HTML. */
|
|
1376
|
+
export declare function transformMediaEmbeds(html: string, options?: JsMediaEmbedsOptions | undefined | null): string
|
|
1377
|
+
|
|
1229
1378
|
/**
|
|
1230
1379
|
* Transforms mermaid code blocks in HTML to rendered SVG diagrams.
|
|
1231
1380
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox-content/napi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.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.32.0",
|
|
49
|
+
"@ox-content/binding-darwin-arm64": "2.32.0",
|
|
50
|
+
"@ox-content/binding-linux-x64-gnu": "2.32.0",
|
|
51
|
+
"@ox-content/binding-linux-arm64-gnu": "2.32.0",
|
|
52
|
+
"@ox-content/binding-win32-x64-msvc": "2.32.0"
|
|
53
53
|
}
|
|
54
54
|
}
|