@ox-content/napi 2.63.0 → 2.64.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 (3) hide show
  1. package/index.d.ts +88 -0
  2. package/index.js +2 -0
  3. package/package.json +6 -6
package/index.d.ts CHANGED
@@ -1,5 +1,39 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ /** Stateful Markdown parser for append-only streams. */
4
+ export declare class IncrementalMarkdownParser {
5
+ /** Creates an incremental Markdown parser. */
6
+ constructor(options?: JsParserOptions | undefined | null)
7
+ /** Appends Markdown and returns committed plus optional provisional AST JSON. */
8
+ append(chunk: string, options?: JsIncrementalParseOptions | undefined | null): IncrementalMarkdownParseResult
9
+ /** Finalizes the stream and commits any remaining Markdown. */
10
+ finish(options?: JsIncrementalParseOptions | undefined | null): IncrementalMarkdownParseResult
11
+ /** Clears all stream state. */
12
+ reset(): void
13
+ /** Returns the current unstable Markdown tail. */
14
+ get pendingMarkdown(): string
15
+ /** Returns the number of bytes committed from the stream. */
16
+ get committedBytes(): number
17
+ /** Returns the total number of bytes observed from the stream. */
18
+ get totalBytes(): number
19
+ }
20
+
21
+ /** Stateful Markdown-to-HTML renderer for append-only streams. */
22
+ export declare class IncrementalMarkdownRenderer {
23
+ /** Creates an incremental Markdown renderer. */
24
+ constructor(options?: JsParserOptions | undefined | null)
25
+ /** Appends Markdown and returns committed delta plus provisional HTML. */
26
+ append(chunk: string, options?: JsIncrementalRenderOptions | undefined | null): IncrementalMarkdownRenderResult
27
+ /** Finalizes the stream and commits any remaining Markdown. */
28
+ finish(): IncrementalMarkdownRenderResult
29
+ /** Clears parser, renderer, and accumulated HTML state. */
30
+ reset(): void
31
+ /** Returns all committed HTML so far. */
32
+ get committedHtml(): string
33
+ /** Returns the current unstable Markdown tail. */
34
+ get pendingMarkdown(): string
35
+ }
36
+
3
37
  /** Builds the public API export graph from entry points. */
4
38
  export declare function buildExportGraph(entryPoints: Array<JsEntryPointSpec>, options?: JsGraphOptions | undefined | null): JsExportGraph
5
39
 
@@ -199,6 +233,40 @@ export interface I18NLoadResult {
199
233
  errors: Array<string>
200
234
  }
201
235
 
236
+ /** Incremental parser append result. */
237
+ export interface IncrementalMarkdownParseResult {
238
+ ast: string
239
+ pendingAst: string
240
+ markdown: string
241
+ pendingMarkdown: string
242
+ committedByteStart: number
243
+ committedByteEnd: number
244
+ committedBytes: number
245
+ pendingBytes: number
246
+ totalBytes: number
247
+ didCommit: boolean
248
+ isFinal: boolean
249
+ errors: Array<string>
250
+ }
251
+
252
+ /** Incremental renderer append result. */
253
+ export interface IncrementalMarkdownRenderResult {
254
+ deltaHtml: string
255
+ committedHtml: string
256
+ pendingHtml: string
257
+ html: string
258
+ markdown: string
259
+ pendingMarkdown: string
260
+ committedByteStart: number
261
+ committedByteEnd: number
262
+ committedBytes: number
263
+ pendingBytes: number
264
+ totalBytes: number
265
+ didCommit: boolean
266
+ isFinal: boolean
267
+ errors: Array<string>
268
+ }
269
+
202
270
  /** Attribute syntax transform options. */
203
271
  export interface JsAttrsOptions {
204
272
  /** Enable markdown-it-attrs style `{#id .class key=value}`. */
@@ -668,6 +736,26 @@ export interface JsI18NRuntimeLocale {
668
736
  dir?: string
669
737
  }
670
738
 
739
+ /** Options for appending to an incremental parser. */
740
+ export interface JsIncrementalParseOptions {
741
+ /** Treat this append as the final stream chunk. */
742
+ isFinal?: boolean
743
+ /** Include a provisional AST for the current unstable tail. */
744
+ includePendingAst?: boolean
745
+ /** Temporarily close unmatched inline delimiters in the provisional AST. */
746
+ completeInline?: boolean
747
+ }
748
+
749
+ /** Options for appending to an incremental renderer. */
750
+ export interface JsIncrementalRenderOptions {
751
+ /** Treat this append as the final stream chunk. */
752
+ isFinal?: boolean
753
+ /** Render the current unstable tail as replaceable provisional HTML. */
754
+ renderPending?: boolean
755
+ /** Temporarily close unmatched inline delimiters in provisional HTML. */
756
+ completeInline?: boolean
757
+ }
758
+
671
759
  /** Locale information for the locale switcher. */
672
760
  export interface JsLocaleInfo {
673
761
  /** BCP 47 locale tag. */
package/index.js CHANGED
@@ -74,6 +74,8 @@ module.exports.parseTransferRaw = binding.parseTransferRaw;
74
74
  module.exports.parseMdastRaw = binding.parseMdastRaw;
75
75
  module.exports.parseAndRender = binding.parseAndRender;
76
76
  module.exports.parseAndRenderAsync = binding.parseAndRenderAsync;
77
+ module.exports.IncrementalMarkdownParser = binding.IncrementalMarkdownParser;
78
+ module.exports.IncrementalMarkdownRenderer = binding.IncrementalMarkdownRenderer;
77
79
  module.exports.prepareSource = binding.prepareSource;
78
80
  module.exports.prepareSourceRaw = binding.prepareSourceRaw;
79
81
  module.exports.lintMarkdown = binding.lintMarkdown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/napi",
3
- "version": "2.63.0",
3
+ "version": "2.64.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.63.0",
49
- "@ox-content/binding-darwin-arm64": "2.63.0",
50
- "@ox-content/binding-linux-x64-gnu": "2.63.0",
51
- "@ox-content/binding-linux-arm64-gnu": "2.63.0",
52
- "@ox-content/binding-win32-x64-msvc": "2.63.0"
48
+ "@ox-content/binding-darwin-x64": "2.64.0",
49
+ "@ox-content/binding-darwin-arm64": "2.64.0",
50
+ "@ox-content/binding-linux-x64-gnu": "2.64.0",
51
+ "@ox-content/binding-linux-arm64-gnu": "2.64.0",
52
+ "@ox-content/binding-win32-x64-msvc": "2.64.0"
53
53
  }
54
54
  }