md4x 0.0.3 → 0.0.4

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/lib/napi.d.mts CHANGED
@@ -3,5 +3,6 @@ import type { ComarkTree } from "./types.js";
3
3
  export type { ComarkTree, ComarkNode, ComarkElement, ComarkText, ComarkElementAttributes } from "./types.js";
4
4
 
5
5
  export declare function renderToHtml(input: string): string;
6
- export declare function renderToJson(input: string): ComarkTree;
6
+ export declare function renderToJson(input: string): string;
7
+ export declare function parseAST(input: string): ComarkTree;
7
8
  export declare function renderToAnsi(input: string): string;
package/lib/napi.mjs CHANGED
@@ -19,7 +19,11 @@ export function renderToHtml(input) {
19
19
  }
20
20
 
21
21
  export function renderToJson(input) {
22
- return JSON.parse(binding.renderToJson(input));
22
+ return binding.renderToJson(input);
23
+ }
24
+
25
+ export function parseAST(input) {
26
+ return JSON.parse(renderToJson(input));
23
27
  }
24
28
 
25
29
  export function renderToAnsi(input) {
package/lib/wasm.d.mts CHANGED
@@ -4,5 +4,6 @@ export type { ComarkTree, ComarkNode, ComarkElement, ComarkText, ComarkElementAt
4
4
 
5
5
  export declare function initWasm(input?: ArrayBuffer | Uint8Array | WebAssembly.Module | Response | Promise<Response>): Promise<void>;
6
6
  export declare function renderToHtml(input: string): string;
7
- export declare function renderToJson(input: string): ComarkTree;
7
+ export declare function renderToJson(input: string): string;
8
+ export declare function parseAST(input: string): ComarkTree;
8
9
  export declare function renderToAnsi(input: string): string;
package/lib/wasm.mjs CHANGED
@@ -45,7 +45,11 @@ export function renderToHtml(input) {
45
45
  }
46
46
 
47
47
  export function renderToJson(input) {
48
- return JSON.parse(render(getExports(), getExports().md4x_to_json, input));
48
+ return render(getExports(), getExports().md4x_to_json, input);
49
+ }
50
+
51
+ export function parseAST(input) {
52
+ return JSON.parse(renderToJson(input));
49
53
  }
50
54
 
51
55
  export function renderToAnsi(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md4x",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {