md4x 0.0.20 → 0.0.22
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/build/md4x.darwin-arm64.node +0 -0
- package/build/md4x.darwin-x64.node +0 -0
- package/build/md4x.linux-arm.node +0 -0
- package/build/md4x.linux-arm64-musl.node +0 -0
- package/build/md4x.linux-arm64.node +0 -0
- package/build/md4x.linux-x64-musl.node +0 -0
- package/build/md4x.linux-x64.node +0 -0
- package/build/md4x.wasm +0 -0
- package/build/md4x.win32-arm64.node +0 -0
- package/build/md4x.win32-x64.node +0 -0
- package/lib/_shared.mjs +66 -7
- package/lib/cli.mjs +23 -3
- package/lib/napi.d.mts +9 -4
- package/lib/napi.mjs +21 -3
- package/lib/types.d.mts +34 -0
- package/lib/wasm/common.mjs +48 -22
- package/lib/wasm/default.mjs +1 -0
- package/lib/wasm/index.d.mts +7 -4
- package/lib/wasm/unwasm.mjs +1 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/build/md4x.wasm
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/_shared.mjs
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
const decoder = new TextDecoder();
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function parseCodeMeta(bytes, extraFields) {
|
|
4
4
|
const nullIdx = bytes.indexOf(0);
|
|
5
5
|
if (nullIdx === -1) {
|
|
6
|
-
return {
|
|
6
|
+
return { output: decoder.decode(bytes), codeBlocks: [] };
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const outBytes = bytes.subarray(0, nullIdx);
|
|
9
9
|
const metaBytes = bytes.subarray(nullIdx + 1);
|
|
10
|
-
const
|
|
10
|
+
const output = decoder.decode(outBytes);
|
|
11
11
|
const meta = JSON.parse(decoder.decode(metaBytes));
|
|
12
12
|
const codeBlocks = meta.map((m) => {
|
|
13
|
-
const start = decoder.decode(
|
|
14
|
-
const end = decoder.decode(
|
|
13
|
+
const start = decoder.decode(outBytes.subarray(0, m.s)).length;
|
|
14
|
+
const end = decoder.decode(outBytes.subarray(0, m.e)).length;
|
|
15
15
|
const block = { start, end, lang: m.l || "" };
|
|
16
16
|
if (m.f) block.filename = m.f;
|
|
17
17
|
if (m.h) block.highlights = m.h;
|
|
18
|
+
if (extraFields) extraFields(block, m);
|
|
18
19
|
return block;
|
|
19
20
|
});
|
|
20
|
-
return {
|
|
21
|
+
return { output, codeBlocks };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function parseHtmlMeta(bytes) {
|
|
25
|
+
const { output, codeBlocks } = parseCodeMeta(bytes);
|
|
26
|
+
return { html: output, codeBlocks };
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
export function parseHtmlWithHighlighting(bytes, highlighter) {
|
|
@@ -54,3 +60,56 @@ function unescapeHtml(str) {
|
|
|
54
60
|
.replaceAll(">", ">")
|
|
55
61
|
.replaceAll(""", '"');
|
|
56
62
|
}
|
|
63
|
+
|
|
64
|
+
const DIM = "\x1b[2m";
|
|
65
|
+
const DIM_OFF = "\x1b[22m";
|
|
66
|
+
|
|
67
|
+
export function parseAnsiMeta(bytes) {
|
|
68
|
+
const { output, codeBlocks } = parseCodeMeta(bytes, (block, m) => {
|
|
69
|
+
if (m.i) block.prefix = m.i;
|
|
70
|
+
});
|
|
71
|
+
return { ansi: output, codeBlocks };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function parseAnsiWithHighlighting(bytes, highlighter) {
|
|
75
|
+
const { ansi, codeBlocks } = parseAnsiMeta(bytes);
|
|
76
|
+
if (codeBlocks.length === 0) return ansi;
|
|
77
|
+
let out = "";
|
|
78
|
+
let pos = 0;
|
|
79
|
+
for (const block of codeBlocks) {
|
|
80
|
+
const region = ansi.slice(block.start, block.end);
|
|
81
|
+
const prefix = block.prefix || " ";
|
|
82
|
+
// Strip DIM wrapper and extract raw code by removing prefix from each line
|
|
83
|
+
let inner = region;
|
|
84
|
+
if (inner.startsWith(DIM)) inner = inner.slice(DIM.length);
|
|
85
|
+
if (inner.endsWith(DIM_OFF)) inner = inner.slice(0, -DIM_OFF.length);
|
|
86
|
+
const code = inner
|
|
87
|
+
.split("\n")
|
|
88
|
+
.filter((l) => l.length > 0)
|
|
89
|
+
.map((l) => (l.startsWith(prefix) ? l.slice(prefix.length) : l))
|
|
90
|
+
.join("\n");
|
|
91
|
+
const highlighted = highlighter(code, block);
|
|
92
|
+
if (highlighted === undefined) {
|
|
93
|
+
out += ansi.slice(pos, block.end);
|
|
94
|
+
} else {
|
|
95
|
+
out += ansi.slice(pos, block.start);
|
|
96
|
+
// Wrap each line with the indent prefix
|
|
97
|
+
const lines = highlighted.split("\n");
|
|
98
|
+
for (let i = 0; i < lines.length; i++) {
|
|
99
|
+
if (lines[i].length > 0) {
|
|
100
|
+
out += prefix + lines[i];
|
|
101
|
+
}
|
|
102
|
+
if (i < lines.length - 1) {
|
|
103
|
+
out += "\n";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Ensure trailing newline
|
|
107
|
+
if (!highlighted.endsWith("\n")) out += "\n";
|
|
108
|
+
pos = block.end;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
pos = block.end;
|
|
112
|
+
}
|
|
113
|
+
out += ansi.slice(pos);
|
|
114
|
+
return out;
|
|
115
|
+
}
|
package/lib/cli.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
renderToHtml,
|
|
7
7
|
renderToAnsi,
|
|
8
8
|
renderToText,
|
|
9
|
+
renderToMarkdown,
|
|
9
10
|
parseAST,
|
|
10
11
|
parseMeta,
|
|
11
12
|
heal,
|
|
@@ -24,6 +25,8 @@ const { values, positionals } = parseArgs({
|
|
|
24
25
|
"html-title": { type: "string" },
|
|
25
26
|
"html-css": { type: "string" },
|
|
26
27
|
heal: { type: "boolean", default: false },
|
|
28
|
+
"show-urls": { type: "boolean", default: false },
|
|
29
|
+
"show-frontmatter": { type: "boolean", default: false },
|
|
27
30
|
stat: { type: "boolean", short: "s", default: false },
|
|
28
31
|
help: { type: "boolean", short: "h", default: false },
|
|
29
32
|
version: { type: "boolean", short: "v", default: false },
|
|
@@ -45,8 +48,10 @@ ${_g("Usage:")} ${_b("md4x")} ${_d("[OPTION]... [FILE]")}
|
|
|
45
48
|
|
|
46
49
|
${_g("General options:")}
|
|
47
50
|
${_c("-o")}, ${_c("--output")}=${_d("FILE")} Output file ${_d("(default: stdout)")}
|
|
48
|
-
${_c("-t")}, ${_c("--format")}=${_d("FORMAT")} Output format: ${_c("html")}, ${_c("text")}, ${_c("ast")}, ${_c("ansi")}, ${_c("meta")}, ${_c("heal")} ${_d("(default: ansi for TTY, text otherwise)")}
|
|
51
|
+
${_c("-t")}, ${_c("--format")}=${_d("FORMAT")} Output format: ${_c("html")}, ${_c("text")}, ${_c("ast")}, ${_c("ansi")}, ${_c("meta")}, ${_c("markdown")}, ${_c("heal")} ${_d("(default: ansi for TTY, text otherwise)")}
|
|
49
52
|
${_c("--heal")} Heal incomplete markdown before rendering
|
|
53
|
+
${_c("--show-urls")} Show link URLs after link text ${_d("(ANSI only)")}
|
|
54
|
+
${_c("--show-frontmatter")} Show frontmatter content ${_d("(ANSI only)")}
|
|
50
55
|
${_c("-s")}, ${_c("--stat")} Measure parsing time
|
|
51
56
|
${_c("-h")}, ${_c("--help")} Display this help and exit
|
|
52
57
|
${_c("-v")}, ${_c("--version")} Display version and exit
|
|
@@ -92,7 +97,15 @@ if (values.version) {
|
|
|
92
97
|
process.exit(0);
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
const supportedFormats = [
|
|
100
|
+
const supportedFormats = [
|
|
101
|
+
"html",
|
|
102
|
+
"ast",
|
|
103
|
+
"ansi",
|
|
104
|
+
"text",
|
|
105
|
+
"meta",
|
|
106
|
+
"markdown",
|
|
107
|
+
"heal",
|
|
108
|
+
];
|
|
96
109
|
const format = values.format;
|
|
97
110
|
if (!supportedFormats.includes(format)) {
|
|
98
111
|
process.stderr.write(`Unknown format: ${format}\n`);
|
|
@@ -165,7 +178,11 @@ switch (format) {
|
|
|
165
178
|
output = renderToHtml(input, healOpt);
|
|
166
179
|
break;
|
|
167
180
|
case "ansi":
|
|
168
|
-
output = renderToAnsi(input,
|
|
181
|
+
output = renderToAnsi(input, {
|
|
182
|
+
...healOpt,
|
|
183
|
+
showUrls: values["show-urls"],
|
|
184
|
+
showFrontmatter: values["show-frontmatter"],
|
|
185
|
+
});
|
|
169
186
|
break;
|
|
170
187
|
case "text":
|
|
171
188
|
output = renderToText(input, healOpt);
|
|
@@ -176,6 +193,9 @@ switch (format) {
|
|
|
176
193
|
case "meta":
|
|
177
194
|
output = JSON.stringify(parseMeta(input, healOpt), null, 2);
|
|
178
195
|
break;
|
|
196
|
+
case "markdown":
|
|
197
|
+
output = renderToMarkdown(input, healOpt);
|
|
198
|
+
break;
|
|
179
199
|
case "heal":
|
|
180
200
|
output = heal(input);
|
|
181
201
|
break;
|
package/lib/napi.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
ComarkTree,
|
|
3
3
|
ComarkMeta,
|
|
4
4
|
HtmlOptions,
|
|
5
|
+
AnsiOptions,
|
|
5
6
|
RenderOptions,
|
|
6
7
|
} from "./types.mjs";
|
|
7
8
|
|
|
@@ -14,6 +15,7 @@ export type {
|
|
|
14
15
|
ComarkHeading,
|
|
15
16
|
ComarkMeta,
|
|
16
17
|
HtmlOptions,
|
|
18
|
+
AnsiOptions,
|
|
17
19
|
RenderOptions,
|
|
18
20
|
} from "./types.mjs";
|
|
19
21
|
|
|
@@ -24,8 +26,10 @@ export interface NAPIBinding {
|
|
|
24
26
|
renderToHtmlMeta(input: string): Buffer;
|
|
25
27
|
renderToAST(input: string, flags?: number): string;
|
|
26
28
|
renderToAnsi(input: string, flags?: number): string;
|
|
29
|
+
renderToAnsiMeta(input: string): Buffer;
|
|
27
30
|
renderToMeta(input: string, flags?: number): string;
|
|
28
31
|
renderToText(input: string, flags?: number): string;
|
|
32
|
+
renderToMarkdown(input: string, flags?: number): string;
|
|
29
33
|
heal(input: string): string;
|
|
30
34
|
}
|
|
31
35
|
|
|
@@ -43,10 +47,7 @@ export declare function parseAST(
|
|
|
43
47
|
input: string,
|
|
44
48
|
opts?: RenderOptions,
|
|
45
49
|
): ComarkTree;
|
|
46
|
-
export declare function renderToAnsi(
|
|
47
|
-
input: string,
|
|
48
|
-
opts?: RenderOptions,
|
|
49
|
-
): string;
|
|
50
|
+
export declare function renderToAnsi(input: string, opts?: AnsiOptions): string;
|
|
50
51
|
export declare function renderToMeta(
|
|
51
52
|
input: string,
|
|
52
53
|
opts?: RenderOptions,
|
|
@@ -59,4 +60,8 @@ export declare function renderToText(
|
|
|
59
60
|
input: string,
|
|
60
61
|
opts?: RenderOptions,
|
|
61
62
|
): string;
|
|
63
|
+
export declare function renderToMarkdown(
|
|
64
|
+
input: string,
|
|
65
|
+
opts?: RenderOptions,
|
|
66
|
+
): string;
|
|
62
67
|
export declare function heal(input: string): string;
|
package/lib/napi.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
parseHtmlWithHighlighting,
|
|
3
|
+
parseAnsiWithHighlighting,
|
|
4
|
+
} from "./_shared.mjs";
|
|
2
5
|
|
|
3
6
|
// --- internal ---
|
|
4
7
|
|
|
@@ -62,8 +65,18 @@ export function parseAST(input, opts) {
|
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
export function renderToAnsi(input, opts) {
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
let flags = opts?.heal ? HEAL_FLAG : 0;
|
|
69
|
+
if (opts?.showUrls) flags |= 0x0010;
|
|
70
|
+
if (opts?.showFrontmatter) flags |= 0x0020;
|
|
71
|
+
if (!opts?.highlighter) {
|
|
72
|
+
return getBinding().renderToAnsi(str(input), flags);
|
|
73
|
+
}
|
|
74
|
+
const s = opts?.heal ? getBinding().heal(str(input)) : str(input);
|
|
75
|
+
const buf = getBinding().renderToAnsiMeta(s);
|
|
76
|
+
return parseAnsiWithHighlighting(
|
|
77
|
+
new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength),
|
|
78
|
+
opts.highlighter,
|
|
79
|
+
);
|
|
67
80
|
}
|
|
68
81
|
|
|
69
82
|
export function renderToMeta(input, opts) {
|
|
@@ -76,6 +89,11 @@ export function renderToText(input, opts) {
|
|
|
76
89
|
return getBinding().renderToText(str(input), flags);
|
|
77
90
|
}
|
|
78
91
|
|
|
92
|
+
export function renderToMarkdown(input, opts) {
|
|
93
|
+
const flags = opts?.heal ? HEAL_FLAG : 0;
|
|
94
|
+
return getBinding().renderToMarkdown(str(input), flags);
|
|
95
|
+
}
|
|
96
|
+
|
|
79
97
|
export function parseMeta(input, opts) {
|
|
80
98
|
const meta = JSON.parse(renderToMeta(input, opts));
|
|
81
99
|
if (!meta.title && meta.headings?.[0]) {
|
package/lib/types.d.mts
CHANGED
|
@@ -34,6 +34,18 @@ export interface RenderOptions {
|
|
|
34
34
|
heal?: boolean;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export interface AnsiOptions extends RenderOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Custom highlighter function for fenced code blocks. If provided, code blocks
|
|
40
|
+
* are passed through this callback which can return custom ANSI-highlighted output.
|
|
41
|
+
*/
|
|
42
|
+
highlighter?: AnsiCodeBlockHighlighter;
|
|
43
|
+
/** Show link URLs after link text (e.g. `text (url)`). Default: false (links are clickable via OSC 8). */
|
|
44
|
+
showUrls?: boolean;
|
|
45
|
+
/** Show frontmatter content as dim text. Default: false (frontmatter is suppressed). */
|
|
46
|
+
showFrontmatter?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
37
49
|
export interface HtmlOptions extends RenderOptions {
|
|
38
50
|
/** Generate a full HTML document with `<!DOCTYPE html>`, `<head>`, and `<body>`. */
|
|
39
51
|
full?: boolean;
|
|
@@ -70,3 +82,25 @@ export interface HtmlWithCodeBlocks {
|
|
|
70
82
|
/** Metadata for each fenced code block in document order */
|
|
71
83
|
codeBlocks: CodeBlock[];
|
|
72
84
|
}
|
|
85
|
+
|
|
86
|
+
export interface AnsiCodeBlock {
|
|
87
|
+
/** Character offset in ANSI string where code block starts (including DIM escape) */
|
|
88
|
+
start: number;
|
|
89
|
+
/** Character offset in ANSI string where code block ends (including DIM_OFF escape) */
|
|
90
|
+
end: number;
|
|
91
|
+
/** Language identifier (empty string if none) */
|
|
92
|
+
lang: string;
|
|
93
|
+
/** Filename from `[filename]` syntax */
|
|
94
|
+
filename?: string;
|
|
95
|
+
/** Highlighted line numbers from `{1-3,5}` syntax */
|
|
96
|
+
highlights?: number[];
|
|
97
|
+
/** Line indent prefix (includes ANSI escapes for colored bars in nested contexts) */
|
|
98
|
+
prefix?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type AnsiCodeBlockHighlighter = (
|
|
102
|
+
/** Raw code content (indentation stripped) */
|
|
103
|
+
code: string,
|
|
104
|
+
/** Code block metadata (lang, filename, highlights, offsets) */
|
|
105
|
+
block: AnsiCodeBlock,
|
|
106
|
+
) => string | undefined;
|
package/lib/wasm/common.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
parseHtmlWithHighlighting,
|
|
3
|
+
parseAnsiWithHighlighting,
|
|
4
|
+
} from "../_shared.mjs";
|
|
2
5
|
|
|
3
6
|
// --- internal ---
|
|
4
7
|
|
|
@@ -57,27 +60,14 @@ function render(exports, fn, input, ...extra) {
|
|
|
57
60
|
return result;
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (opts?.heal) flags |= HEAL_FLAG;
|
|
65
|
-
const exports = _getExports();
|
|
66
|
-
if (!opts?.highlighter) {
|
|
67
|
-
return render(exports, exports.md4x_to_html, input, flags);
|
|
68
|
-
}
|
|
69
|
-
const {
|
|
70
|
-
memory,
|
|
71
|
-
md4x_alloc,
|
|
72
|
-
md4x_free,
|
|
73
|
-
md4x_to_html_meta,
|
|
74
|
-
md4x_result_ptr,
|
|
75
|
-
md4x_result_size,
|
|
76
|
-
} = exports;
|
|
63
|
+
/* Render with a meta function, returning raw bytes for highlighter processing. */
|
|
64
|
+
function renderMetaBytes(exports, metaFn, input) {
|
|
65
|
+
const { memory, md4x_alloc, md4x_free, md4x_result_ptr, md4x_result_size } =
|
|
66
|
+
exports;
|
|
77
67
|
const encoded = new TextEncoder().encode(str(input));
|
|
78
68
|
const ptr = md4x_alloc(encoded.length);
|
|
79
69
|
new Uint8Array(memory.buffer).set(encoded, ptr);
|
|
80
|
-
const ret =
|
|
70
|
+
const ret = metaFn(ptr, encoded.length);
|
|
81
71
|
md4x_free(ptr);
|
|
82
72
|
if (ret !== 0) {
|
|
83
73
|
throw new Error("md4x: render failed");
|
|
@@ -85,8 +75,25 @@ export function renderToHtml(input, opts) {
|
|
|
85
75
|
const outPtr = md4x_result_ptr();
|
|
86
76
|
const outSize = md4x_result_size();
|
|
87
77
|
const bytes = new Uint8Array(memory.buffer, outPtr, outSize);
|
|
78
|
+
return { bytes, outPtr };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const HEAL_FLAG = 0x0100;
|
|
82
|
+
|
|
83
|
+
export function renderToHtml(input, opts) {
|
|
84
|
+
let flags = opts?.full ? 0x0008 : 0;
|
|
85
|
+
if (opts?.heal) flags |= HEAL_FLAG;
|
|
86
|
+
const exports = _getExports();
|
|
87
|
+
if (!opts?.highlighter) {
|
|
88
|
+
return render(exports, exports.md4x_to_html, input, flags);
|
|
89
|
+
}
|
|
90
|
+
const { bytes, outPtr } = renderMetaBytes(
|
|
91
|
+
exports,
|
|
92
|
+
exports.md4x_to_html_meta,
|
|
93
|
+
input,
|
|
94
|
+
);
|
|
88
95
|
const result = parseHtmlWithHighlighting(bytes, opts.highlighter);
|
|
89
|
-
md4x_free(outPtr);
|
|
96
|
+
exports.md4x_free(outPtr);
|
|
90
97
|
return result;
|
|
91
98
|
}
|
|
92
99
|
|
|
@@ -101,9 +108,22 @@ export function parseAST(input, opts) {
|
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
export function renderToAnsi(input, opts) {
|
|
104
|
-
|
|
111
|
+
let flags = opts?.heal ? HEAL_FLAG : 0;
|
|
112
|
+
if (opts?.showUrls) flags |= 0x0010;
|
|
113
|
+
if (opts?.showFrontmatter) flags |= 0x0020;
|
|
105
114
|
const exports = _getExports();
|
|
106
|
-
|
|
115
|
+
if (!opts?.highlighter) {
|
|
116
|
+
return render(exports, exports.md4x_to_ansi, input, flags);
|
|
117
|
+
}
|
|
118
|
+
const s = opts?.heal ? heal(str(input)) : str(input);
|
|
119
|
+
const { bytes, outPtr } = renderMetaBytes(
|
|
120
|
+
exports,
|
|
121
|
+
exports.md4x_to_ansi_meta,
|
|
122
|
+
s,
|
|
123
|
+
);
|
|
124
|
+
const result = parseAnsiWithHighlighting(bytes, opts.highlighter);
|
|
125
|
+
exports.md4x_free(outPtr);
|
|
126
|
+
return result;
|
|
107
127
|
}
|
|
108
128
|
|
|
109
129
|
export function renderToMeta(input, opts) {
|
|
@@ -118,6 +138,12 @@ export function renderToText(input, opts) {
|
|
|
118
138
|
return render(exports, exports.md4x_to_text, input, flags);
|
|
119
139
|
}
|
|
120
140
|
|
|
141
|
+
export function renderToMarkdown(input, opts) {
|
|
142
|
+
const flags = opts?.heal ? HEAL_FLAG : 0;
|
|
143
|
+
const exports = _getExports();
|
|
144
|
+
return render(exports, exports.md4x_to_markdown, input, flags);
|
|
145
|
+
}
|
|
146
|
+
|
|
121
147
|
export function parseMeta(input, opts) {
|
|
122
148
|
const meta = JSON.parse(renderToMeta(input, opts));
|
|
123
149
|
if (!meta.title && meta.headings?.[0]) {
|
package/lib/wasm/default.mjs
CHANGED
package/lib/wasm/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
ComarkTree,
|
|
3
3
|
ComarkMeta,
|
|
4
4
|
HtmlOptions,
|
|
5
|
+
AnsiOptions,
|
|
5
6
|
RenderOptions,
|
|
6
7
|
} from "../types.mjs";
|
|
7
8
|
|
|
@@ -14,6 +15,7 @@ export type {
|
|
|
14
15
|
ComarkHeading,
|
|
15
16
|
ComarkMeta,
|
|
16
17
|
HtmlOptions,
|
|
18
|
+
AnsiOptions,
|
|
17
19
|
RenderOptions,
|
|
18
20
|
} from "../types.mjs";
|
|
19
21
|
|
|
@@ -36,10 +38,7 @@ export declare function parseAST(
|
|
|
36
38
|
input: string,
|
|
37
39
|
opts?: RenderOptions,
|
|
38
40
|
): ComarkTree;
|
|
39
|
-
export declare function renderToAnsi(
|
|
40
|
-
input: string,
|
|
41
|
-
opts?: RenderOptions,
|
|
42
|
-
): string;
|
|
41
|
+
export declare function renderToAnsi(input: string, opts?: AnsiOptions): string;
|
|
43
42
|
export declare function renderToMeta(
|
|
44
43
|
input: string,
|
|
45
44
|
opts?: RenderOptions,
|
|
@@ -52,4 +51,8 @@ export declare function renderToText(
|
|
|
52
51
|
input: string,
|
|
53
52
|
opts?: RenderOptions,
|
|
54
53
|
): string;
|
|
54
|
+
export declare function renderToMarkdown(
|
|
55
|
+
input: string,
|
|
56
|
+
opts?: RenderOptions,
|
|
57
|
+
): string;
|
|
55
58
|
export declare function heal(input: string): string;
|
package/lib/wasm/unwasm.mjs
CHANGED