@ox-content/napi 2.30.0 → 2.31.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.
Files changed (2) hide show
  1. package/index.d.ts +145 -0
  2. 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
@@ -314,6 +367,38 @@ export interface JsDocsOutputOptions {
314
367
  pathStrategy?: 'flat' | 'typedoc'
315
368
  }
316
369
 
370
+ /** Docs-as-tests extraction options. */
371
+ export interface JsDocsTestOptions {
372
+ /** Enable docs test extraction. */
373
+ enabled?: boolean
374
+ /** Languages that can be emitted as test cases. */
375
+ languages?: Array<string>
376
+ /** Require fence meta such as `test`, `runnable`, or `vitest`. */
377
+ requireMeta?: boolean
378
+ }
379
+
380
+ /** Edit-this-page link options. */
381
+ export interface JsEditThisPageOptions {
382
+ /** Enable edit link generation. */
383
+ enabled?: boolean
384
+ /** GitHub repository URL, e.g. `https://github.com/owner/repo`. */
385
+ repoUrl?: string
386
+ /** Branch used in edit URLs. */
387
+ branch?: string
388
+ /** Root directory used to relativize `sourcePath`. */
389
+ rootDir?: string
390
+ /** Link label. */
391
+ label?: string
392
+ }
393
+
394
+ /** Emoji-shortcode transform options. */
395
+ export interface JsEmojiShortcodeOptions {
396
+ /** Enable `:shortcode:` expansion. */
397
+ enabled?: boolean
398
+ /** Custom shortcode map. Values are emitted verbatim. */
399
+ custom?: Record<string, string>
400
+ }
401
+
317
402
  /** Entry page configuration. */
318
403
  export interface JsEntryPageConfig {
319
404
  /** Hero section. */
@@ -532,6 +617,20 @@ export interface JsMarkdownLintRuleOptions {
532
617
  trailingSpaces?: boolean
533
618
  }
534
619
 
620
+ /** Built-in media embed transform switches. */
621
+ export interface JsMediaEmbedsOptions {
622
+ /** Render `<Spotify>` embeds. */
623
+ spotify?: boolean
624
+ /** Render `<StackBlitz>` embeds. */
625
+ stackBlitz?: boolean
626
+ /** Render `<Tweet>` / `<XPost>` static cards. */
627
+ twitter?: boolean
628
+ /** Render `<Bluesky>` static cards. */
629
+ bluesky?: boolean
630
+ /** Render `<WebContainer>` lazy placeholder blocks. */
631
+ webContainer?: boolean
632
+ }
633
+
535
634
  /** OG image configuration for JavaScript. */
536
635
  export interface JsOgImageConfig {
537
636
  /** Image width in pixels. */
@@ -612,6 +711,18 @@ export interface JsResolvedModule {
612
711
  exports: Array<JsPublicExport>
613
712
  }
614
713
 
714
+ /** HTML sanitizer options. */
715
+ export interface JsSanitizeOptions {
716
+ /** Enable sanitizer. When omitted, passing this object enables it. */
717
+ enabled?: boolean
718
+ /** Allowed tag names. Omit for safe defaults. */
719
+ allowedTags?: Array<string>
720
+ /** Allowed attribute names. Omit for safe defaults. */
721
+ allowedAttributes?: Array<string>
722
+ /** Allowed URL schemes for href/src/action attributes. Omit for safe defaults. */
723
+ allowedUrlSchemes?: Array<string>
724
+ }
725
+
615
726
  /** Search query split into free text and scope prefixes. */
616
727
  export interface JsScopedSearchQuery {
617
728
  /** Free-text terms after removing scope prefixes. */
@@ -1051,6 +1162,31 @@ export interface JsTransformOptions {
1051
1162
  * Defaults to true; ignored when [`Self::autolink_urls`] is off.
1052
1163
  */
1053
1164
  autolinkTargetBlank?: boolean
1165
+ /** Opt-in Obsidian-style wiki links. */
1166
+ wikiLinks?: JsWikiLinkOptions
1167
+ /** Opt-in emoji shortcode expansion. */
1168
+ emojiShortcodes?: JsEmojiShortcodeOptions
1169
+ /** Opt-in markdown-it-attrs style attributes. */
1170
+ attributes?: JsAttrsOptions
1171
+ /**
1172
+ * Opt-in CJK emphasis compatibility flag. The parser is already CJK-friendly;
1173
+ * this keeps the feature explicit in the public API.
1174
+ */
1175
+ cjkEmphasis?: boolean
1176
+ /** Opt-in VitePress-style code import/snippet injection. */
1177
+ codeImports?: JsCodeImportOptions
1178
+ /** Opt-in HTML sanitizer. */
1179
+ sanitize?: JsSanitizeOptions
1180
+ /** Opt-in edit-this-page link generation. */
1181
+ editThisPage?: JsEditThisPageOptions
1182
+ }
1183
+
1184
+ /** Wiki-link transform options. */
1185
+ export interface JsWikiLinkOptions {
1186
+ /** Enable `[[target]]` and `[[target|label]]` expansion. */
1187
+ enabled?: boolean
1188
+ /** Base URL used for site-relative wiki links. */
1189
+ baseUrl?: string
1054
1190
  }
1055
1191
 
1056
1192
  /**
@@ -1068,6 +1204,9 @@ export interface JsYouTubeOptions {
1068
1204
  lazyLoad?: boolean
1069
1205
  }
1070
1206
 
1207
+ /** Lint fenced code blocks in Markdown. */
1208
+ export declare function lintCodeBlocks(source: string, options?: JsCodeBlockLintOptions | undefined | null): Array<JsCodeBlockDiagnostic>
1209
+
1071
1210
  export declare function lintMarkdown(source: string, options?: JsMarkdownLintOptions | undefined | null): JsMarkdownLintResult
1072
1211
 
1073
1212
  export declare function lintMarkdownDocuments(sources: Array<string>, options?: JsMarkdownLintOptions | undefined | null): Array<JsMarkdownLintResult>
@@ -1188,6 +1327,9 @@ export declare function resolveSsgNavigationGroups(navigation: Array<JsSsgNaviga
1188
1327
  /** Resolves all output and public route paths for an SSG page. */
1189
1328
  export declare function resolveSsgRoutePaths(inputPath: string, srcDir: string, outDir: string, base: string, extension: string, siteUrl?: string | undefined | null): JsSsgRoutePaths
1190
1329
 
1330
+ /** Sanitize an HTML string with safe defaults or an explicit allow-list. */
1331
+ export declare function sanitizeHtml(html: string, options?: JsSanitizeOptions | undefined | null): string
1332
+
1191
1333
  /**
1192
1334
  * Searches a serialized index.
1193
1335
  *
@@ -1226,6 +1368,9 @@ export declare function transformAsync(source: string, options?: JsTransformOpti
1226
1368
  */
1227
1369
  export declare function transformMdastRaw(source: string, options?: JsTransformOptions | undefined | null): Uint8Array
1228
1370
 
1371
+ /** Transform opt-in static media embed components in already-rendered HTML. */
1372
+ export declare function transformMediaEmbeds(html: string, options?: JsMediaEmbedsOptions | undefined | null): string
1373
+
1229
1374
  /**
1230
1375
  * Transforms mermaid code blocks in HTML to rendered SVG diagrams.
1231
1376
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/napi",
3
- "version": "2.30.0",
3
+ "version": "2.31.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.30.0",
49
- "@ox-content/binding-darwin-arm64": "2.30.0",
50
- "@ox-content/binding-linux-x64-gnu": "2.30.0",
51
- "@ox-content/binding-linux-arm64-gnu": "2.30.0",
52
- "@ox-content/binding-win32-x64-msvc": "2.30.0"
48
+ "@ox-content/binding-darwin-x64": "2.31.0",
49
+ "@ox-content/binding-darwin-arm64": "2.31.0",
50
+ "@ox-content/binding-linux-x64-gnu": "2.31.0",
51
+ "@ox-content/binding-linux-arm64-gnu": "2.31.0",
52
+ "@ox-content/binding-win32-x64-msvc": "2.31.0"
53
53
  }
54
54
  }