@paperclover/markodown 1.0.0-rc.3
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/LICENSE +15 -0
- package/_dist/esbuild.d.ts +14 -0
- package/_dist/esbuild.d.ts.map +1 -0
- package/_dist/mod.d.ts +93 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/rollup.d.ts +11 -0
- package/_dist/rollup.d.ts.map +1 -0
- package/bindgen/markodown.d.ts +42 -0
- package/bindgen/markodown.js +416 -0
- package/bindgen/wasm_bytes.d.ts +2 -0
- package/bindgen/wasm_bytes.js +2 -0
- package/clover.test.ts +343 -0
- package/esbuild.js +70 -0
- package/esbuild.js.map +1 -0
- package/esbuild.ts +88 -0
- package/mod.js +20 -0
- package/mod.js.map +1 -0
- package/mod.test.ts +127 -0
- package/mod.ts +144 -0
- package/package.json +39 -0
- package/rollup.js +54 -0
- package/rollup.js.map +1 -0
- package/rollup.ts +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright 2026 clover caruso
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
6
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
7
|
+
and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
11
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
13
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
14
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
15
|
+
THIS SOFTWARE.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as markodown from "./mod.js";
|
|
2
|
+
import * as marko from "@marko/compiler";
|
|
3
|
+
import type * as esbuild from "esbuild";
|
|
4
|
+
export type EsbuildPluginOptions = Omit<markodown.TransformOptions, "source" | "format"> & {
|
|
5
|
+
marko?: typeof marko;
|
|
6
|
+
markoOptions?: marko.Config;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* esbuild or Bun bundling plugin. Because Bun markets itself as compatible with
|
|
10
|
+
* plugins made for esbuild, this plugin is designed to work around differences
|
|
11
|
+
* in Bun's implementation to allow it to work. Bugs reported for subtle behavior
|
|
12
|
+
* mistakes that are not present when using `esbuild` will not be fixed.
|
|
13
|
+
*/ export default function esbuildPlugin(options?: EsbuildPluginOptions): esbuild.Plugin;
|
|
14
|
+
//# sourceMappingURL=esbuild.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.d.ts","sources":["../esbuild.ts"],"names":[],"mappings":"AAAA,YAAY,0BAA0B;AACtC,YAAY,6BAAoC;AAChD,iBAAiB,uBAA+B;AAIhD,YAAY,uBACR,KAAK,UAAU,kBAAkB,WAAW;EAE5C,eAAe;EACf,eAAe,MAAM;;AAGzB;;;;;CAKC,GACD,eAAe,SAAS,cACtB,UAAS,oBAAyB,GACjC,QAAQ"}
|
package/_dist/mod.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
type Transformed = Success | Failure;
|
|
2
|
+
export interface TransformOptions {
|
|
3
|
+
source: string;
|
|
4
|
+
/**
|
|
5
|
+
* Specify the allowed output formats. For simplicity, pass `marko`. By
|
|
6
|
+
* including `html`, you can opt into a faster codepath where plain HTML is
|
|
7
|
+
* returned to you as such, when no Marko features are used.
|
|
8
|
+
* @default ["marko"]
|
|
9
|
+
*/ format?: Array<"marko" | "html">;
|
|
10
|
+
/** Wraps the component in another component. Enables Table of Contents generation */ layoutImport?: string;
|
|
11
|
+
/** Import path for the module itself, passed to the layout as `module` */ selfImport?: string;
|
|
12
|
+
/** Replace built-in elements with custom components */ componentImports?: ComponentImports;
|
|
13
|
+
/**
|
|
14
|
+
* When true, disables all Marko extensions, turning this into a pure
|
|
15
|
+
* Markdown parser. Marko tags, template expressions, statements, and
|
|
16
|
+
* comments will be treated as plain text. Defaults to HTML output.
|
|
17
|
+
* @default false
|
|
18
|
+
*/ markdownOnly?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* These extensions are special-cased so that Clover can re-use this on
|
|
21
|
+
* her website without
|
|
22
|
+
*/ cloverExtensions?: CloverQuestionExtensions;
|
|
23
|
+
}
|
|
24
|
+
/** Replace Built In Elements */ export interface ComponentImports {
|
|
25
|
+
/** Replace (h1-h6) with this import. Receives attribute `level: number`. */ heading?: string;
|
|
26
|
+
/** Replace `pre > code` with this import. */ codeBlock?: string;
|
|
27
|
+
/** Replace markdown links with this import. */ link?: string;
|
|
28
|
+
/** Replace images with this import. */ image?: string;
|
|
29
|
+
/** Replace blockquotes with this import. */ blockquote?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Clover's question extensions are syntax features used on the years of backlog
|
|
33
|
+
* from https://paperclover.net/q+a. It was easier to re-implement these than
|
|
34
|
+
* convert everything into Marko. Besides, there are some extra things that
|
|
35
|
+
* make it so these must emit HTML and not Marko, so these components all
|
|
36
|
+
* emit custom HTML elements instead of imported components.
|
|
37
|
+
*
|
|
38
|
+
* Also includes `@html <raw>` block syntax for raw HTML passthrough.
|
|
39
|
+
*/ export interface CloverQuestionExtensions {
|
|
40
|
+
/**
|
|
41
|
+
* Element name for question blocks. Not an import path.
|
|
42
|
+
* `q: ...inline...` -> `<question>...</question>`
|
|
43
|
+
*
|
|
44
|
+
* `q: ...inline...\nq: ...inline...`
|
|
45
|
+
* ^ this inserts a `<br />` between them since theyre stuck together.
|
|
46
|
+
*/ question: string;
|
|
47
|
+
/**
|
|
48
|
+
* Element name for artifact ref. Not an import path.
|
|
49
|
+
* `@its-snowing` -> `<artifactRef>its-snowing</artifactRef>`
|
|
50
|
+
*/ artifactRef: string;
|
|
51
|
+
/**
|
|
52
|
+
* Element name for question ref. Not an import path.
|
|
53
|
+
* `#2602142011` -> `<questionRef>2602142011</questionRef>`
|
|
54
|
+
*
|
|
55
|
+
* Question refs are 10 or 12 numbers in a row.
|
|
56
|
+
*/ questionRef: string;
|
|
57
|
+
/**
|
|
58
|
+
* Element name for Labelled redactions.
|
|
59
|
+
* `##name##` -> `<labelledRedaction>name</labelledRedaction>`
|
|
60
|
+
*/ labelledRedaction: string;
|
|
61
|
+
}
|
|
62
|
+
export type OutputFormat = "marko" | "html";
|
|
63
|
+
export interface Success {
|
|
64
|
+
success: true;
|
|
65
|
+
text: string;
|
|
66
|
+
errors: [];
|
|
67
|
+
outline: Header[] | null;
|
|
68
|
+
}
|
|
69
|
+
export interface Failure {
|
|
70
|
+
success: false;
|
|
71
|
+
text: null;
|
|
72
|
+
errors: TransformError[];
|
|
73
|
+
outline: Header[] | null;
|
|
74
|
+
}
|
|
75
|
+
export interface Header {
|
|
76
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
77
|
+
id: string;
|
|
78
|
+
html: string;
|
|
79
|
+
}
|
|
80
|
+
export interface TransformError {
|
|
81
|
+
message: string;
|
|
82
|
+
labels: LabelledSpan[];
|
|
83
|
+
line: number;
|
|
84
|
+
column: number;
|
|
85
|
+
}
|
|
86
|
+
export interface LabelledSpan {
|
|
87
|
+
message: string;
|
|
88
|
+
line: number;
|
|
89
|
+
column: number;
|
|
90
|
+
width: number;
|
|
91
|
+
}
|
|
92
|
+
export declare function transform(options: TransformOptions): Transformed;
|
|
93
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"KAKK,cAAc,UAAU;AAE7B,iBAAiB;EACf,QAAQ,MAAM;EACd;;;;;GAKC,GACD,SAAS,MAAM,UAAU;EACzB,mFAAmF,GACnF,eAAe,MAAM;EACrB,wEAAwE,GACxE,aAAa,MAAM;EACnB,qDAAqD,GACrD,mBAAmB;EACnB;;;;;GAKC,GACD,eAAe,OAAO;EACtB;;;GAGC,GACD,mBAAmB;;AAGrB,8BAA8B,GAC9B,iBAAiB;EACf,0EAA0E,GAC1E,UAAU,MAAM;EAChB,2CAA2C,GAC3C,YAAY,MAAM;EAClB,6CAA6C,GAC7C,OAAO,MAAM;EACb,qCAAqC,GACrC,QAAQ,MAAM;EACd,0CAA0C,GAC1C,aAAa,MAAM;;AAGrB;;;;;;;;CAQC,GACD,iBAAiB;EACf;;;;;;GAMC,GACD,UAAU,MAAM;EAChB;;;GAGC,GACD,aAAa,MAAM;EACnB;;;;;GAKC,GACD,aAAa,MAAM;EACnB;;;GAGC,GACD,mBAAmB,MAAM;;AAG3B,YAAY,eAAe,UAAU;AAErC,iBAAiB;EACf,SAAS,IAAI;EACb,MAAM,MAAM;EACZ;EACA,SAAS,WAAW,IAAI;;AAG1B,iBAAiB;EACf,SAAS,KAAK;EACd,MAAM,IAAI;EACV,QAAQ;EACR,SAAS,WAAW,IAAI;;AAG1B,iBAAiB;EACf,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI;EAC3B,IAAI,MAAM;EACV,MAAM,MAAM;;AAGd,iBAAiB;EACf,SAAS,MAAM;EACf,QAAQ;EACR,MAAM,MAAM;EACZ,QAAQ,MAAM;;AAGhB,iBAAiB;EACf,SAAS,MAAM;EACf,MAAM,MAAM;EACZ,QAAQ,MAAM;EACd,OAAO,MAAM;;AAGf,OAAO,iBAAS,UAAU,SAAS,gBAAgB,GAAG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as markodown from "./mod.js";
|
|
2
|
+
import * as marko from "@marko/compiler";
|
|
3
|
+
import type * as rollup from "rollup";
|
|
4
|
+
export type RollupPluginOptions = Omit<markodown.TransformOptions, "source" | "format"> & {
|
|
5
|
+
marko?: typeof marko;
|
|
6
|
+
markoOptions?: marko.Config;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Rollup bundling plugin for markodown files.
|
|
10
|
+
*/ export default function rollupPlugin(options?: RollupPluginOptions): rollup.Plugin;
|
|
11
|
+
//# sourceMappingURL=rollup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sources":["../rollup.ts"],"names":[],"mappings":"AAAA,YAAY,0BAA0B;AACtC,YAAY,6BAAoC;AAChD,iBAAiB,qBAA4B;AAG7C,YAAY,sBACR,KAAK,UAAU,kBAAkB,WAAW;EAE5C,eAAe;EACf,eAAe,MAAM;;AAGzB;;CAEC,GACD,eAAe,SAAS,aACtB,UAAS,mBAAwB,GAChC,OAAO"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export enum OutputFormat {
|
|
5
|
+
Html = 0,
|
|
6
|
+
Marko = 1,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function transform(src: string, force_format: OutputFormat | null | undefined, layout_import: string | null | undefined, component_imports: any, self_path: string | null | undefined, markdown_only: boolean | null | undefined, clover_extensions: any): any;
|
|
10
|
+
|
|
11
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
12
|
+
|
|
13
|
+
export interface InitOutput {
|
|
14
|
+
readonly memory: WebAssembly.Memory;
|
|
15
|
+
readonly transform: (a: number, b: number, c: number, d: number, e: number, f: any, g: number, h: number, i: number, j: any) => any;
|
|
16
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
17
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
18
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
19
|
+
readonly __wbindgen_start: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
26
|
+
* a precompiled `WebAssembly.Module`.
|
|
27
|
+
*
|
|
28
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
29
|
+
*
|
|
30
|
+
* @returns {InitOutput}
|
|
31
|
+
*/
|
|
32
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
36
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
37
|
+
*
|
|
38
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
39
|
+
*
|
|
40
|
+
* @returns {Promise<InitOutput>}
|
|
41
|
+
*/
|
|
42
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
/* @ts-self-types="./markodown.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @enum {0 | 1}
|
|
5
|
+
*/
|
|
6
|
+
export const OutputFormat = Object.freeze({
|
|
7
|
+
Html: 0, "0": "Html",
|
|
8
|
+
Marko: 1, "1": "Marko",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} src
|
|
13
|
+
* @param {OutputFormat | null | undefined} force_format
|
|
14
|
+
* @param {string | null | undefined} layout_import
|
|
15
|
+
* @param {any} component_imports
|
|
16
|
+
* @param {string | null | undefined} self_path
|
|
17
|
+
* @param {boolean | null | undefined} markdown_only
|
|
18
|
+
* @param {any} clover_extensions
|
|
19
|
+
* @returns {any}
|
|
20
|
+
*/
|
|
21
|
+
export function transform(src, force_format, layout_import, component_imports, self_path, markdown_only, clover_extensions) {
|
|
22
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
23
|
+
const len0 = WASM_VECTOR_LEN;
|
|
24
|
+
var ptr1 = isLikeNone(layout_import) ? 0 : passStringToWasm0(layout_import, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
25
|
+
var len1 = WASM_VECTOR_LEN;
|
|
26
|
+
var ptr2 = isLikeNone(self_path) ? 0 : passStringToWasm0(self_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
27
|
+
var len2 = WASM_VECTOR_LEN;
|
|
28
|
+
const ret = wasm.transform(ptr0, len0, isLikeNone(force_format) ? 2 : force_format, ptr1, len1, component_imports, ptr2, len2, isLikeNone(markdown_only) ? 0xFFFFFF : markdown_only ? 1 : 0, clover_extensions);
|
|
29
|
+
return ret;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function __wbg_get_imports() {
|
|
33
|
+
const import0 = {
|
|
34
|
+
__proto__: null,
|
|
35
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
36
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
37
|
+
return ret;
|
|
38
|
+
},
|
|
39
|
+
__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
|
|
40
|
+
const v = arg0;
|
|
41
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
42
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
43
|
+
},
|
|
44
|
+
__wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
|
|
45
|
+
const ret = debugString(arg1);
|
|
46
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
47
|
+
const len1 = WASM_VECTOR_LEN;
|
|
48
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
49
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
50
|
+
},
|
|
51
|
+
__wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
|
|
52
|
+
const ret = arg0 in arg1;
|
|
53
|
+
return ret;
|
|
54
|
+
},
|
|
55
|
+
__wbg___wbindgen_is_null_ac34f5003991759a: function(arg0) {
|
|
56
|
+
const ret = arg0 === null;
|
|
57
|
+
return ret;
|
|
58
|
+
},
|
|
59
|
+
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
60
|
+
const val = arg0;
|
|
61
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
62
|
+
return ret;
|
|
63
|
+
},
|
|
64
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
65
|
+
const ret = arg0 === undefined;
|
|
66
|
+
return ret;
|
|
67
|
+
},
|
|
68
|
+
__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
|
|
69
|
+
const ret = arg0 == arg1;
|
|
70
|
+
return ret;
|
|
71
|
+
},
|
|
72
|
+
__wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
|
|
73
|
+
const obj = arg1;
|
|
74
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
75
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
76
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
77
|
+
},
|
|
78
|
+
__wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
|
|
79
|
+
const obj = arg1;
|
|
80
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
81
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
82
|
+
var len1 = WASM_VECTOR_LEN;
|
|
83
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
84
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
85
|
+
},
|
|
86
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
87
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
88
|
+
},
|
|
89
|
+
__wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) {
|
|
90
|
+
const ret = arg0[arg1];
|
|
91
|
+
return ret;
|
|
92
|
+
},
|
|
93
|
+
__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
|
|
94
|
+
let result;
|
|
95
|
+
try {
|
|
96
|
+
result = arg0 instanceof ArrayBuffer;
|
|
97
|
+
} catch (_) {
|
|
98
|
+
result = false;
|
|
99
|
+
}
|
|
100
|
+
const ret = result;
|
|
101
|
+
return ret;
|
|
102
|
+
},
|
|
103
|
+
__wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
|
|
104
|
+
let result;
|
|
105
|
+
try {
|
|
106
|
+
result = arg0 instanceof Uint8Array;
|
|
107
|
+
} catch (_) {
|
|
108
|
+
result = false;
|
|
109
|
+
}
|
|
110
|
+
const ret = result;
|
|
111
|
+
return ret;
|
|
112
|
+
},
|
|
113
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
114
|
+
const ret = arg0.length;
|
|
115
|
+
return ret;
|
|
116
|
+
},
|
|
117
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
118
|
+
const ret = new Object();
|
|
119
|
+
return ret;
|
|
120
|
+
},
|
|
121
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
122
|
+
const ret = new Array();
|
|
123
|
+
return ret;
|
|
124
|
+
},
|
|
125
|
+
__wbg_new_dd2b680c8bf6ae29: function(arg0) {
|
|
126
|
+
const ret = new Uint8Array(arg0);
|
|
127
|
+
return ret;
|
|
128
|
+
},
|
|
129
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
130
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
131
|
+
},
|
|
132
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
133
|
+
arg0[arg1] = arg2;
|
|
134
|
+
},
|
|
135
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
136
|
+
arg0[arg1 >>> 0] = arg2;
|
|
137
|
+
},
|
|
138
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
139
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
140
|
+
const ret = arg0;
|
|
141
|
+
return ret;
|
|
142
|
+
},
|
|
143
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
144
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
145
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
146
|
+
return ret;
|
|
147
|
+
},
|
|
148
|
+
__wbindgen_init_externref_table: function() {
|
|
149
|
+
const table = wasm.__wbindgen_externrefs;
|
|
150
|
+
const offset = table.grow(4);
|
|
151
|
+
table.set(0, undefined);
|
|
152
|
+
table.set(offset + 0, undefined);
|
|
153
|
+
table.set(offset + 1, null);
|
|
154
|
+
table.set(offset + 2, true);
|
|
155
|
+
table.set(offset + 3, false);
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
return {
|
|
159
|
+
__proto__: null,
|
|
160
|
+
"./markodown_bg.js": import0,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function debugString(val) {
|
|
165
|
+
// primitive types
|
|
166
|
+
const type = typeof val;
|
|
167
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
168
|
+
return `${val}`;
|
|
169
|
+
}
|
|
170
|
+
if (type == 'string') {
|
|
171
|
+
return `"${val}"`;
|
|
172
|
+
}
|
|
173
|
+
if (type == 'symbol') {
|
|
174
|
+
const description = val.description;
|
|
175
|
+
if (description == null) {
|
|
176
|
+
return 'Symbol';
|
|
177
|
+
} else {
|
|
178
|
+
return `Symbol(${description})`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (type == 'function') {
|
|
182
|
+
const name = val.name;
|
|
183
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
184
|
+
return `Function(${name})`;
|
|
185
|
+
} else {
|
|
186
|
+
return 'Function';
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// objects
|
|
190
|
+
if (Array.isArray(val)) {
|
|
191
|
+
const length = val.length;
|
|
192
|
+
let debug = '[';
|
|
193
|
+
if (length > 0) {
|
|
194
|
+
debug += debugString(val[0]);
|
|
195
|
+
}
|
|
196
|
+
for(let i = 1; i < length; i++) {
|
|
197
|
+
debug += ', ' + debugString(val[i]);
|
|
198
|
+
}
|
|
199
|
+
debug += ']';
|
|
200
|
+
return debug;
|
|
201
|
+
}
|
|
202
|
+
// Test for built-in
|
|
203
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
204
|
+
let className;
|
|
205
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
206
|
+
className = builtInMatches[1];
|
|
207
|
+
} else {
|
|
208
|
+
// Failed to match the standard '[object ClassName]'
|
|
209
|
+
return toString.call(val);
|
|
210
|
+
}
|
|
211
|
+
if (className == 'Object') {
|
|
212
|
+
// we're a user defined class or Object
|
|
213
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
214
|
+
// easier than looping through ownProperties of `val`.
|
|
215
|
+
try {
|
|
216
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
217
|
+
} catch (_) {
|
|
218
|
+
return 'Object';
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// errors
|
|
222
|
+
if (val instanceof Error) {
|
|
223
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
224
|
+
}
|
|
225
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
226
|
+
return className;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
230
|
+
ptr = ptr >>> 0;
|
|
231
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
let cachedDataViewMemory0 = null;
|
|
235
|
+
function getDataViewMemory0() {
|
|
236
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
237
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
238
|
+
}
|
|
239
|
+
return cachedDataViewMemory0;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function getStringFromWasm0(ptr, len) {
|
|
243
|
+
ptr = ptr >>> 0;
|
|
244
|
+
return decodeText(ptr, len);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let cachedUint8ArrayMemory0 = null;
|
|
248
|
+
function getUint8ArrayMemory0() {
|
|
249
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
250
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
251
|
+
}
|
|
252
|
+
return cachedUint8ArrayMemory0;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function isLikeNone(x) {
|
|
256
|
+
return x === undefined || x === null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
260
|
+
if (realloc === undefined) {
|
|
261
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
262
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
263
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
264
|
+
WASM_VECTOR_LEN = buf.length;
|
|
265
|
+
return ptr;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
let len = arg.length;
|
|
269
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
270
|
+
|
|
271
|
+
const mem = getUint8ArrayMemory0();
|
|
272
|
+
|
|
273
|
+
let offset = 0;
|
|
274
|
+
|
|
275
|
+
for (; offset < len; offset++) {
|
|
276
|
+
const code = arg.charCodeAt(offset);
|
|
277
|
+
if (code > 0x7F) break;
|
|
278
|
+
mem[ptr + offset] = code;
|
|
279
|
+
}
|
|
280
|
+
if (offset !== len) {
|
|
281
|
+
if (offset !== 0) {
|
|
282
|
+
arg = arg.slice(offset);
|
|
283
|
+
}
|
|
284
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
285
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
286
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
287
|
+
|
|
288
|
+
offset += ret.written;
|
|
289
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
WASM_VECTOR_LEN = offset;
|
|
293
|
+
return ptr;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
297
|
+
cachedTextDecoder.decode();
|
|
298
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
299
|
+
let numBytesDecoded = 0;
|
|
300
|
+
function decodeText(ptr, len) {
|
|
301
|
+
numBytesDecoded += len;
|
|
302
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
303
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
304
|
+
cachedTextDecoder.decode();
|
|
305
|
+
numBytesDecoded = len;
|
|
306
|
+
}
|
|
307
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const cachedTextEncoder = new TextEncoder();
|
|
311
|
+
|
|
312
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
313
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
314
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
315
|
+
view.set(buf);
|
|
316
|
+
return {
|
|
317
|
+
read: arg.length,
|
|
318
|
+
written: buf.length
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
let WASM_VECTOR_LEN = 0;
|
|
324
|
+
|
|
325
|
+
let wasmModule, wasm;
|
|
326
|
+
function __wbg_finalize_init(instance, module) {
|
|
327
|
+
wasm = instance.exports;
|
|
328
|
+
wasmModule = module;
|
|
329
|
+
cachedDataViewMemory0 = null;
|
|
330
|
+
cachedUint8ArrayMemory0 = null;
|
|
331
|
+
wasm.__wbindgen_start();
|
|
332
|
+
return wasm;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async function __wbg_load(module, imports) {
|
|
336
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
337
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
338
|
+
try {
|
|
339
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
340
|
+
} catch (e) {
|
|
341
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
342
|
+
|
|
343
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
344
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
345
|
+
|
|
346
|
+
} else { throw e; }
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const bytes = await module.arrayBuffer();
|
|
351
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
352
|
+
} else {
|
|
353
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
354
|
+
|
|
355
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
356
|
+
return { instance, module };
|
|
357
|
+
} else {
|
|
358
|
+
return instance;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function expectedResponseType(type) {
|
|
363
|
+
switch (type) {
|
|
364
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
365
|
+
}
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function initSync(module) {
|
|
371
|
+
if (wasm !== undefined) return wasm;
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
if (module !== undefined) {
|
|
375
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
376
|
+
({module} = module)
|
|
377
|
+
} else {
|
|
378
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const imports = __wbg_get_imports();
|
|
383
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
384
|
+
module = new WebAssembly.Module(module);
|
|
385
|
+
}
|
|
386
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
387
|
+
return __wbg_finalize_init(instance, module);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
async function __wbg_init(module_or_path) {
|
|
391
|
+
if (wasm !== undefined) return wasm;
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
if (module_or_path !== undefined) {
|
|
395
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
396
|
+
({module_or_path} = module_or_path)
|
|
397
|
+
} else {
|
|
398
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (module_or_path === undefined) {
|
|
403
|
+
module_or_path = new URL('markodown_bg.wasm', import.meta.url);
|
|
404
|
+
}
|
|
405
|
+
const imports = __wbg_get_imports();
|
|
406
|
+
|
|
407
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
408
|
+
module_or_path = fetch(module_or_path);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
412
|
+
|
|
413
|
+
return __wbg_finalize_init(instance, module);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export { initSync, __wbg_init as default };
|