mq-web 0.5.4 → 0.5.6

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/README.md CHANGED
@@ -19,7 +19,7 @@ npm install mq-web
19
19
  ## Quick Start
20
20
 
21
21
  ```typescript
22
- import { run, format } from "mq-web";
22
+ import { run, format, htmlToMarkdown } from "mq-web";
23
23
 
24
24
  // Transform markdown list style
25
25
  const markdown = `- First item
@@ -37,6 +37,15 @@ console.log(result);
37
37
  const formatted = await format("map(to_text)|select(gt(5))");
38
38
  console.log(formatted);
39
39
  // Output: map(to_text) | select(gt(5))
40
+
41
+ // Convert HTML to Markdown
42
+ const html = "<h1>Hello World</h1><p>This is a paragraph.</p>";
43
+ const md = await htmlToMarkdown(html);
44
+ console.log(md);
45
+ // Output:
46
+ // # Hello World
47
+ //
48
+ // This is a paragraph.
40
49
  ```
41
50
 
42
51
  ## API Reference
@@ -77,6 +86,15 @@ Get defined values (functions, selectors, variables) from mq code.
77
86
 
78
87
  Returns: `Promise<ReadonlyArray<DefinedValue>>` - Array of defined values
79
88
 
89
+ #### `htmlToMarkdown(html, options?)`
90
+
91
+ Convert HTML to markdown format.
92
+
93
+ - `html`: string - The HTML content to convert
94
+ - `options`: Partial<ConversionOptions> - Conversion options
95
+
96
+ Returns: `Promise<string>` - The converted markdown content
97
+
80
98
  ## Examples
81
99
 
82
100
  ### Extract and Transform Headings
@@ -119,6 +137,35 @@ const uppercase = await run(".[] | upcase()", markdown);
119
137
  // Output: - APPLE\n- BANANA\n- CHERRY
120
138
  ```
121
139
 
140
+ ### HTML to Markdown Conversion
141
+
142
+ ```typescript
143
+ import { htmlToMarkdown } from "mq-web";
144
+
145
+ const html = `
146
+ <article>
147
+ <h1>Welcome to mq</h1>
148
+ <p>A <strong>powerful</strong> tool for <em>Markdown</em> processing.</p>
149
+ <ul>
150
+ <li>Easy to use</li>
151
+ <li>Fast performance</li>
152
+ <li>Web-compatible</li>
153
+ </ul>
154
+ </article>
155
+ `;
156
+
157
+ const markdown = await htmlToMarkdown(html);
158
+ console.log(markdown);
159
+ // Output:
160
+ // # Welcome to mq
161
+ //
162
+ // A **powerful** tool for _Markdown_ processing.
163
+ //
164
+ // - Easy to use
165
+ // - Fast performance
166
+ // - Web-compatible
167
+ ```
168
+
122
169
  ### Error Handling
123
170
 
124
171
  ```typescript
package/dist/core.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var D=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var C=(e,n)=>()=>(e&&(n=e(e=0)),n);var T=(e,n)=>{for(var t in n)D(e,t,{get:n[t],enumerable:!0})},H=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of q(n))!$.call(e,i)&&i!==t&&D(e,i,{get:()=>n[i],enumerable:!(r=z(n,i))||r.enumerable});return e};var N=e=>H(D({},"__esModule",{value:!0}),e);var B={};T(B,{RunOptions:()=>S,default:()=>P,definedValues:()=>ee,diagnostics:()=>ne,format:()=>te,initSync:()=>se,run:()=>re,toAst:()=>ie});function s(e){x===w.length&&w.push(w.length+1);let n=x;return x=w[n],w[n]=e,n}function R(e){let n=typeof e;if(n=="number"||n=="boolean"||e==null)return`${e}`;if(n=="string")return`"${e}"`;if(n=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(n=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,a="[";i>0&&(a+=R(e[0]));for(let _=1;_<i;_++)a+=", "+R(e[_]);return a+="]",a}let t=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(t&&t.length>1)r=t[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
- ${e.stack}`:r}function v(e){e<132||(w[e]=x,x=e)}function G(e,n){return e=e>>>0,h().subarray(e/1,e/1+n)}function y(){return(p===null||p.buffer.detached===!0||p.buffer.detached===void 0&&p.buffer!==c.memory.buffer)&&(p=new DataView(c.memory.buffer)),p}function O(e,n){return e=e>>>0,J(e,n)}function h(){return(m===null||m.byteLength===0)&&(m=new Uint8Array(c.memory.buffer)),m}function o(e){return w[e]}function E(e,n){try{return e.apply(this,n)}catch(t){c.__wbindgen_export3(s(t))}}function g(e){return e==null}function X(e,n,t,r){let i={a:e,b:n,cnt:1,dtor:t},a=(..._)=>{i.cnt++;let f=i.a;i.a=0;try{return r(f,i.b,..._)}finally{i.a=f,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--i.cnt===0&&(i.dtor(i.a,i.b),i.a=0,k.unregister(i))},k.register(a,i,i),a}function b(e,n,t){if(t===void 0){let f=A.encode(e),l=n(f.length,1)>>>0;return h().subarray(l,l+f.length).set(f),u=f.length,l}let r=e.length,i=n(r,1)>>>0,a=h(),_=0;for(;_<r;_++){let f=e.charCodeAt(_);if(f>127)break;a[i+_]=f}if(_!==r){_!==0&&(e=e.slice(_)),i=t(i,r,r=_+e.length*3,1)>>>0;let f=h().subarray(i+_,i+r),l=A.encodeInto(e,f);_+=l.written,i=t(i,r,_,1)>>>0}return u=_,i}function d(e){let n=o(e);return v(e),n}function J(e,n){return M+=n,M>=Y&&(W=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),W.decode(),M=n),W.decode(h().subarray(e,e+n))}function K(e,n,t){c.__wasm_bindgen_func_elem_2764(e,n,s(t))}function Q(e,n,t,r){c.__wasm_bindgen_func_elem_718(e,n,s(t),s(r))}function ee(e,n){let t=b(e,c.__wbindgen_export,c.__wbindgen_export2),r=u;var i=g(n)?0:b(n,c.__wbindgen_export,c.__wbindgen_export2),a=u;let _=c.definedValues(t,r,i,a);return d(_)}function ne(e){let n=b(e,c.__wbindgen_export,c.__wbindgen_export2),t=u,r=c.diagnostics(n,t);return d(r)}function te(e){let n=b(e,c.__wbindgen_export,c.__wbindgen_export2),t=u,r=c.format(n,t);return d(r)}function re(e,n,t){let r=b(e,c.__wbindgen_export,c.__wbindgen_export2),i=u,a=b(n,c.__wbindgen_export,c.__wbindgen_export2),_=u,f=c.run(r,i,a,_,s(t));return d(f)}function ie(e){let n=b(e,c.__wbindgen_export,c.__wbindgen_export2),t=u,r=c.toAst(n,t);return d(r)}async function ce(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.ok&&oe.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")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",r);else throw r}let t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{let t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function U(){let e={};return e.wbg={},e.wbg.__wbg_Error_52673b7de5a0ca89=function(n,t){let r=Error(O(n,t));return s(r)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(n,t){let r=String(o(t)),i=b(r,c.__wbindgen_export,c.__wbindgen_export2),a=u;y().setInt32(n+4*1,a,!0),y().setInt32(n+4*0,i,!0)},e.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(n){let t=o(n),r=typeof t=="boolean"?t:void 0;return g(r)?16777215:r?1:0},e.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(n,t){let r=R(o(t)),i=b(r,c.__wbindgen_export,c.__wbindgen_export2),a=u;y().setInt32(n+4*1,a,!0),y().setInt32(n+4*0,i,!0)},e.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317=function(n,t){return o(n)in o(t)},e.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(n){return typeof o(n)=="function"},e.wbg.__wbg___wbindgen_is_object_ce774f3490692386=function(n){let t=o(n);return typeof t=="object"&&t!==null},e.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030=function(n){return typeof o(n)=="string"},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(n){return o(n)===void 0},e.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d=function(n,t){return o(n)==o(t)},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(n,t){let r=o(t),i=typeof r=="number"?r:void 0;y().setFloat64(n+8*1,g(i)?0:i,!0),y().setInt32(n+4*0,!g(i),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(n,t){let r=o(t),i=typeof r=="string"?r:void 0;var a=g(i)?0:b(i,c.__wbindgen_export,c.__wbindgen_export2),_=u;y().setInt32(n+4*1,_,!0),y().setInt32(n+4*0,a,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(n,t){throw new Error(O(n,t))},e.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(n){o(n)._wbg_cb_unref()},e.wbg.__wbg_arrayBuffer_3356d392ef2d2aa9=function(n){let t=o(n).arrayBuffer();return s(t)},e.wbg.__wbg_call_3020136f7a2d6e44=function(){return E(function(n,t,r){let i=o(n).call(o(t),o(r));return s(i)},arguments)},e.wbg.__wbg_call_abb4ff46ce38be40=function(){return E(function(n,t){let r=o(n).call(o(t));return s(r)},arguments)},e.wbg.__wbg_done_62ea16af4ce34b24=function(n){return o(n).done},e.wbg.__wbg_entries_7de5c9edd116e219=function(n){let t=o(n).entries();return s(t)},e.wbg.__wbg_entries_83c79938054e065f=function(n){let t=Object.entries(o(n));return s(t)},e.wbg.__wbg_from_29a8414a7a7cd19d=function(n){let t=Array.from(o(n));return s(t)},e.wbg.__wbg_getDirectory_9beed6c83b6861f5=function(n){let t=o(n).getDirectory();return s(t)},e.wbg.__wbg_getFile_3d12eaf635641f3a=function(n){let t=o(n).getFile();return s(t)},e.wbg.__wbg_get_6b7bd52aca3f9671=function(n,t){let r=o(n)[t>>>0];return s(r)},e.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(n,t){let r=o(n)[o(t)];return s(r)},e.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355=function(n){let t;try{t=o(n)instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_instanceof_FileSystemDirectoryHandle_264085cadc86679a=function(n){let t;try{t=o(n)instanceof FileSystemDirectoryHandle}catch{t=!1}return t},e.wbg.__wbg_instanceof_FileSystemFileHandle_214d69e0ae063fc8=function(n){let t;try{t=o(n)instanceof FileSystemFileHandle}catch{t=!1}return t},e.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(n){let t;try{t=o(n)instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(n){let t;try{t=o(n)instanceof Window}catch{t=!1}return t},e.wbg.__wbg_length_22ac23eaec9d8053=function(n){return o(n).length},e.wbg.__wbg_length_d45040a40c570362=function(n){return o(n).length},e.wbg.__wbg_navigator_b49edef831236138=function(n){let t=o(n).navigator;return s(t)},e.wbg.__wbg_new_1ba21ce319a06297=function(){let n=new Object;return s(n)},e.wbg.__wbg_new_25f239778d6112b9=function(){let n=new Array;return s(n)},e.wbg.__wbg_new_6421f6084cc5bc5a=function(n){let t=new Uint8Array(o(n));return s(t)},e.wbg.__wbg_new_ff12d2b041fb48f1=function(n,t){try{var r={a:n,b:t},i=(_,f)=>{let l=r.a;r.a=0;try{return Q(l,r.b,_,f)}finally{r.a=l}};let a=new Promise(i);return s(a)}finally{r.a=r.b=0}},e.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(n,t){let r=new Function(O(n,t));return s(r)},e.wbg.__wbg_next_b34c09a202bf4424=function(){return E(function(n){let t=o(n).next();return s(t)},arguments)},e.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(n,t,r){Uint8Array.prototype.set.call(G(n,t),o(r))},e.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(n){let t=o(n).queueMicrotask;return s(t)},e.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(n){queueMicrotask(o(n))},e.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(n){let t=Promise.resolve(o(n));return s(t)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(n,t,r){o(n)[d(t)]=d(r)},e.wbg.__wbg_set_7df433eea03a5c14=function(n,t,r){o(n)[t>>>0]=d(r)},e.wbg.__wbg_size_82fbdb656de23326=function(n){return o(n).size},e.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){let n=typeof global>"u"?null:global;return g(n)?0:s(n)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){let n=typeof globalThis>"u"?null:globalThis;return g(n)?0:s(n)},e.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){let n=typeof self>"u"?null:self;return g(n)?0:s(n)},e.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){let n=typeof window>"u"?null:window;return g(n)?0:s(n)},e.wbg.__wbg_storage_b04c3b736f10dd3b=function(n){let t=o(n).storage;return s(t)},e.wbg.__wbg_then_429f7caf1026411d=function(n,t,r){let i=o(n).then(o(t),o(r));return s(i)},e.wbg.__wbg_then_4f95312d68691235=function(n,t){let r=o(n).then(o(t));return s(r)},e.wbg.__wbg_value_57b7b035e117f7ee=function(n){let t=o(n).value;return s(t)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(n,t){let r=O(n,t);return s(r)},e.wbg.__wbindgen_cast_7cc765810adca37d=function(n,t){let r=X(n,t,c.__wasm_bindgen_func_elem_2763,K);return s(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(n){return s(n)},e.wbg.__wbindgen_object_clone_ref=function(n){let t=o(n);return s(t)},e.wbg.__wbindgen_object_drop_ref=function(n){d(n)},e}function V(e,n){return c=e.exports,L.__wbindgen_wasm_module=n,p=null,m=null,c}function se(e){if(c!==void 0)return c;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=U();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let t=new WebAssembly.Instance(e,n);return V(t,e)}async function L(e){if(c!==void 0)return c;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",_e.url));let n=U();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await ce(await e,n);return V(t,r)}var _e,c,k,p,m,w,x,W,Y,M,A,u,Z,S,oe,P,I=C(()=>{"use strict";_e={};k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>e.dtor(e.a,e.b));p=null;m=null;w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);x=w.length;W=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});W.decode();Y=2146435072,M=0;A=new TextEncoder;"encodeInto"in A||(A.encodeInto=function(e,n){let t=A.encode(e);return n.set(t),{read:e.length,written:t.length}});u=0;Z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>c.__wbg_runoptions_free(e>>>0,1)),S=class{__destroy_into_raw(){let n=this.__wbg_ptr;return this.__wbg_ptr=0,Z.unregister(this),n}free(){let n=this.__destroy_into_raw();c.__wbg_runoptions_free(n,0)}};Symbol.dispose&&(S.prototype[Symbol.dispose]=S.prototype.free);oe=new Set(["basic","cors","default"]);P=L});var we={};T(we,{definedValues:()=>ge,diagnostics:()=>be,format:()=>ue,run:()=>ae,toAst:()=>fe});module.exports=N(we);I();var j=null;async function F(){return j||(await(async()=>{try{await P();let e=await Promise.resolve().then(()=>(I(),B));j={run:e.run,toAst:e.toAst,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),j)}async function ae(e,n,t={}){return await(await F()).run(e,n,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...t})}async function fe(e){return await(await F()).toAst(e)}async function ue(e){return await(await F()).format(e)}async function be(e){return await(await F()).diagnostics(e)}async function ge(e,n){return await(await F()).definedValues(e,n)}0&&(module.exports={definedValues,diagnostics,format,run,toAst});
1
+ "use strict";var W=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var $=(e,t)=>()=>(e&&(t=e(e=0)),t);var I=(e,t)=>{for(var n in t)W(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of C(t))!q.call(e,o)&&o!==n&&W(e,o,{get:()=>t[o],enumerable:!(r=B(t,o))||r.enumerable});return e};var N=e=>H(W({},"__esModule",{value:!0}),e);var L={};I(L,{ConversionOptions:()=>m,RunOptions:()=>O,default:()=>R,definedValues:()=>rt,diagnostics:()=>ot,format:()=>it,htmlToMarkdown:()=>_t,initSync:()=>ut,run:()=>st,toAst:()=>ct});function s(e){S===d.length&&d.push(d.length+1);let t=S;return S=d[t],d[t]=e,t}function G(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`)}function D(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let o=e.description;return o==null?"Symbol":`Symbol(${o})`}if(t=="function"){let o=e.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(e)){let o=e.length,a="[";o>0&&(a+=D(e[0]));for(let c=1;c<o;c++)a+=", "+D(e[c]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}function X(e){e<132||(d[e]=S,S=e)}function Y(e,t){return e=e>>>0,A().subarray(e/1,e/1+t)}function p(){return(y===null||y.buffer.detached===!0||y.buffer.detached===void 0&&y.buffer!==_.memory.buffer)&&(y=new DataView(_.memory.buffer)),y}function M(e,t){return e=e>>>0,Q(e,t)}function A(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(_.memory.buffer)),x}function i(e){return d[e]}function j(e,t){try{return e.apply(this,t)}catch(n){_.__wbindgen_export3(s(n))}}function g(e){return e==null}function J(e,t,n,r){let o={a:e,b:t,cnt:1,dtor:n},a=(...c)=>{o.cnt++;let f=o.a;o.a=0;try{return r(f,o.b,...c)}finally{o.a=f,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--o.cnt===0&&(o.dtor(o.a,o.b),o.a=0,v.unregister(o))},v.register(a,o,o),a}function b(e,t,n){if(n===void 0){let f=F.encode(e),l=t(f.length,1)>>>0;return A().subarray(l,l+f.length).set(f),u=f.length,l}let r=e.length,o=t(r,1)>>>0,a=A(),c=0;for(;c<r;c++){let f=e.charCodeAt(c);if(f>127)break;a[o+c]=f}if(c!==r){c!==0&&(e=e.slice(c)),o=n(o,r,r=c+e.length*3,1)>>>0;let f=A().subarray(o+c,o+r),l=F.encodeInto(e,f);c+=l.written,o=n(o,r,c,1)>>>0}return u=c,o}function w(e){let t=i(e);return X(e),t}function Q(e,t){return E+=t,E>=K&&(k=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),k.decode(),E=t),k.decode(A().subarray(e,e+t))}function Z(e,t,n){_.__wasm_bindgen_func_elem_3018(e,t,s(n))}function tt(e,t,n,r){_.__wasm_bindgen_func_elem_816(e,t,s(n),s(r))}function rt(e,t){let n=b(e,_.__wbindgen_export,_.__wbindgen_export2),r=u;var o=g(t)?0:b(t,_.__wbindgen_export,_.__wbindgen_export2),a=u;let c=_.definedValues(n,r,o,a);return w(c)}function ot(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.diagnostics(t,n);return w(r)}function it(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.format(t,n);return w(r)}function _t(e,t){let n=b(e,_.__wbindgen_export,_.__wbindgen_export2),r=u,o=0;g(t)||(G(t,m),o=t.__destroy_into_raw());let a=_.htmlToMarkdown(n,r,o);return w(a)}function st(e,t,n){let r=b(e,_.__wbindgen_export,_.__wbindgen_export2),o=u,a=b(t,_.__wbindgen_export,_.__wbindgen_export2),c=u,f=_.run(r,o,a,c,s(n));return w(f)}function ct(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.toAst(t,n);return w(r)}async function ft(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.ok&&at.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")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",r);else throw r}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function U(){let e={};return e.wbg={},e.wbg.__wbg_Error_52673b7de5a0ca89=function(t,n){let r=Error(M(t,n));return s(r)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,n){let r=String(i(n)),o=b(r,_.__wbindgen_export,_.__wbindgen_export2),a=u;p().setInt32(t+4,a,!0),p().setInt32(t+0,o,!0)},e.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(t){let n=i(t),r=typeof n=="boolean"?n:void 0;return g(r)?16777215:r?1:0},e.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(t,n){let r=D(i(n)),o=b(r,_.__wbindgen_export,_.__wbindgen_export2),a=u;p().setInt32(t+4,a,!0),p().setInt32(t+0,o,!0)},e.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317=function(t,n){return i(t)in i(n)},e.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(t){return typeof i(t)=="function"},e.wbg.__wbg___wbindgen_is_object_ce774f3490692386=function(t){let n=i(t);return typeof n=="object"&&n!==null},e.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030=function(t){return typeof i(t)=="string"},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(t){return i(t)===void 0},e.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d=function(t,n){return i(t)==i(n)},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(t,n){let r=i(n),o=typeof r=="number"?r:void 0;p().setFloat64(t+8,g(o)?0:o,!0),p().setInt32(t+0,!g(o),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(t,n){let r=i(n),o=typeof r=="string"?r:void 0;var a=g(o)?0:b(o,_.__wbindgen_export,_.__wbindgen_export2),c=u;p().setInt32(t+4,c,!0),p().setInt32(t+0,a,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(t,n){throw new Error(M(t,n))},e.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(t){i(t)._wbg_cb_unref()},e.wbg.__wbg_arrayBuffer_3356d392ef2d2aa9=function(t){let n=i(t).arrayBuffer();return s(n)},e.wbg.__wbg_call_3020136f7a2d6e44=function(){return j(function(t,n,r){let o=i(t).call(i(n),i(r));return s(o)},arguments)},e.wbg.__wbg_call_abb4ff46ce38be40=function(){return j(function(t,n){let r=i(t).call(i(n));return s(r)},arguments)},e.wbg.__wbg_done_62ea16af4ce34b24=function(t){return i(t).done},e.wbg.__wbg_entries_7de5c9edd116e219=function(t){let n=i(t).entries();return s(n)},e.wbg.__wbg_entries_83c79938054e065f=function(t){let n=Object.entries(i(t));return s(n)},e.wbg.__wbg_from_29a8414a7a7cd19d=function(t){let n=Array.from(i(t));return s(n)},e.wbg.__wbg_getDirectory_9beed6c83b6861f5=function(t){let n=i(t).getDirectory();return s(n)},e.wbg.__wbg_getFile_3d12eaf635641f3a=function(t){let n=i(t).getFile();return s(n)},e.wbg.__wbg_get_6b7bd52aca3f9671=function(t,n){let r=i(t)[n>>>0];return s(r)},e.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(t,n){let r=i(t)[i(n)];return s(r)},e.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355=function(t){let n;try{n=i(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_instanceof_FileSystemDirectoryHandle_264085cadc86679a=function(t){let n;try{n=i(t)instanceof FileSystemDirectoryHandle}catch{n=!1}return n},e.wbg.__wbg_instanceof_FileSystemFileHandle_214d69e0ae063fc8=function(t){let n;try{n=i(t)instanceof FileSystemFileHandle}catch{n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(t){let n;try{n=i(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(t){let n;try{n=i(t)instanceof Window}catch{n=!1}return n},e.wbg.__wbg_length_22ac23eaec9d8053=function(t){return i(t).length},e.wbg.__wbg_length_d45040a40c570362=function(t){return i(t).length},e.wbg.__wbg_navigator_b49edef831236138=function(t){let n=i(t).navigator;return s(n)},e.wbg.__wbg_new_1ba21ce319a06297=function(){let t=new Object;return s(t)},e.wbg.__wbg_new_25f239778d6112b9=function(){let t=new Array;return s(t)},e.wbg.__wbg_new_6421f6084cc5bc5a=function(t){let n=new Uint8Array(i(t));return s(n)},e.wbg.__wbg_new_ff12d2b041fb48f1=function(t,n){try{var r={a:t,b:n},o=(c,f)=>{let l=r.a;r.a=0;try{return tt(l,r.b,c,f)}finally{r.a=l}};let a=new Promise(o);return s(a)}finally{r.a=r.b=0}},e.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(t,n){let r=new Function(M(t,n));return s(r)},e.wbg.__wbg_next_b34c09a202bf4424=function(){return j(function(t){let n=i(t).next();return s(n)},arguments)},e.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(t,n,r){Uint8Array.prototype.set.call(Y(t,n),i(r))},e.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(t){let n=i(t).queueMicrotask;return s(n)},e.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(t){queueMicrotask(i(t))},e.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(t){let n=Promise.resolve(i(t));return s(n)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,n,r){i(t)[w(n)]=w(r)},e.wbg.__wbg_set_7df433eea03a5c14=function(t,n,r){i(t)[n>>>0]=w(r)},e.wbg.__wbg_size_82fbdb656de23326=function(t){return i(t).size},e.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){let t=typeof global>"u"?null:global;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){let t=typeof globalThis>"u"?null:globalThis;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){let t=typeof self>"u"?null:self;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){let t=typeof window>"u"?null:window;return g(t)?0:s(t)},e.wbg.__wbg_storage_b04c3b736f10dd3b=function(t){let n=i(t).storage;return s(n)},e.wbg.__wbg_then_429f7caf1026411d=function(t,n,r){let o=i(t).then(i(n),i(r));return s(o)},e.wbg.__wbg_then_4f95312d68691235=function(t,n){let r=i(t).then(i(n));return s(r)},e.wbg.__wbg_value_57b7b035e117f7ee=function(t){let n=i(t).value;return s(n)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(t,n){let r=M(t,n);return s(r)},e.wbg.__wbindgen_cast_29480d6a48b8e833=function(t,n){let r=J(t,n,_.__wasm_bindgen_func_elem_3017,Z);return s(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(t){return s(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let n=i(t);return s(n)},e.wbg.__wbindgen_object_drop_ref=function(t){w(t)},e}function V(e,t){return _=e.exports,z.__wbindgen_wasm_module=t,y=null,x=null,_}function ut(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=U();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return V(n,e)}async function z(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",bt.url));let t=U();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await ft(await e,t);return V(n,r)}var bt,_,v,y,x,d,S,k,K,E,F,u,et,nt,m,O,at,R,P=$(()=>{"use strict";bt={};v=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>e.dtor(e.a,e.b));y=null;x=null;d=new Array(128).fill(void 0);d.push(void 0,null,!0,!1);S=d.length;k=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});k.decode();K=2146435072,E=0;F=new TextEncoder;"encodeInto"in F||(F.encodeInto=function(e,t){let n=F.encode(e);return t.set(n),{read:e.length,written:n.length}});u=0;et=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_conversionoptions_free(e>>>0,1)),nt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_runoptions_free(e>>>0,1)),m=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,et.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_conversionoptions_free(t,0)}get extract_scripts_as_code_blocks(){return _.__wbg_get_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr)!==0}set extract_scripts_as_code_blocks(t){_.__wbg_set_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr,t)}get generate_front_matter(){return _.__wbg_get_conversionoptions_generate_front_matter(this.__wbg_ptr)!==0}set generate_front_matter(t){_.__wbg_set_conversionoptions_generate_front_matter(this.__wbg_ptr,t)}get use_title_as_h1(){return _.__wbg_get_conversionoptions_use_title_as_h1(this.__wbg_ptr)!==0}set use_title_as_h1(t){_.__wbg_set_conversionoptions_use_title_as_h1(this.__wbg_ptr,t)}};Symbol.dispose&&(m.prototype[Symbol.dispose]=m.prototype.free);O=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,nt.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_runoptions_free(t,0)}};Symbol.dispose&&(O.prototype[Symbol.dispose]=O.prototype.free);at=new Set(["basic","cors","default"]);R=z});var mt={};I(mt,{definedValues:()=>pt,diagnostics:()=>lt,format:()=>dt,htmlToMarkdown:()=>yt,run:()=>gt,toAst:()=>wt});module.exports=N(mt);P();var T=null;async function h(){return T||(await(async()=>{try{await R();let e=await Promise.resolve().then(()=>(P(),L));T={run:e.run,toAst:e.toAst,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues,htmlToMarkdown:e.htmlToMarkdown}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),T)}async function gt(e,t,n={}){return await(await h()).run(e,t,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...n})}async function wt(e){return await(await h()).toAst(e)}async function dt(e){return await(await h()).format(e)}async function lt(e){return await(await h()).diagnostics(e)}async function pt(e,t){return await(await h()).definedValues(e,t)}async function yt(e,t){return await(await h()).htmlToMarkdown(e,t)}0&&(module.exports={definedValues,diagnostics,format,htmlToMarkdown,run,toAst});
package/dist/core.d.cts CHANGED
@@ -26,6 +26,17 @@ interface Options {
26
26
  linkUrlStyle: 'angle' | 'none' | null,
27
27
  }
28
28
 
29
+
30
+
31
+ declare class ConversionOptions {
32
+ private constructor();
33
+ free(): void;
34
+ [Symbol.dispose](): void;
35
+ extract_scripts_as_code_blocks: boolean;
36
+ generate_front_matter: boolean;
37
+ use_title_as_h1: boolean;
38
+ }
39
+
29
40
  /**
30
41
  * Run an mq
31
42
  */
@@ -46,5 +57,9 @@ declare function diagnostics(code: string): Promise<ReadonlyArray<Diagnostic>>;
46
57
  * Get defined values from mq code
47
58
  */
48
59
  declare function definedValues(code: string, module?: string): Promise<ReadonlyArray<DefinedValue>>;
60
+ /**
61
+ * Converts HTML input to Markdown
62
+ */
63
+ declare function htmlToMarkdown(html: string, options?: ConversionOptions): Promise<string>;
49
64
 
50
- export { definedValues, diagnostics, format, run, toAst };
65
+ export { definedValues, diagnostics, format, htmlToMarkdown, run, toAst };
package/dist/core.d.ts CHANGED
@@ -26,6 +26,17 @@ interface Options {
26
26
  linkUrlStyle: 'angle' | 'none' | null,
27
27
  }
28
28
 
29
+
30
+
31
+ declare class ConversionOptions {
32
+ private constructor();
33
+ free(): void;
34
+ [Symbol.dispose](): void;
35
+ extract_scripts_as_code_blocks: boolean;
36
+ generate_front_matter: boolean;
37
+ use_title_as_h1: boolean;
38
+ }
39
+
29
40
  /**
30
41
  * Run an mq
31
42
  */
@@ -46,5 +57,9 @@ declare function diagnostics(code: string): Promise<ReadonlyArray<Diagnostic>>;
46
57
  * Get defined values from mq code
47
58
  */
48
59
  declare function definedValues(code: string, module?: string): Promise<ReadonlyArray<DefinedValue>>;
60
+ /**
61
+ * Converts HTML input to Markdown
62
+ */
63
+ declare function htmlToMarkdown(html: string, options?: ConversionOptions): Promise<string>;
49
64
 
50
- export { definedValues, diagnostics, format, run, toAst };
65
+ export { definedValues, diagnostics, format, htmlToMarkdown, run, toAst };
package/dist/core.js CHANGED
@@ -1,2 +1,2 @@
1
- var L=Object.defineProperty;var B=(e,n)=>()=>(e&&(n=e(e=0)),n);var z=(e,n)=>{for(var t in n)L(e,t,{get:n[t],enumerable:!0})};var V={};z(V,{RunOptions:()=>S,default:()=>R,definedValues:()=>Y,diagnostics:()=>J,format:()=>K,initSync:()=>te,run:()=>Q,toAst:()=>Z});function s(e){x===w.length&&w.push(w.length+1);let n=x;return x=w[n],w[n]=e,n}function M(e){let n=typeof e;if(n=="number"||n=="boolean"||e==null)return`${e}`;if(n=="string")return`"${e}"`;if(n=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(n=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,a="[";i>0&&(a+=M(e[0]));for(let _=1;_<i;_++)a+=", "+M(e[_]);return a+="]",a}let t=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(t&&t.length>1)r=t[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
- ${e.stack}`:r}function q(e){e<132||(w[e]=x,x=e)}function $(e,n){return e=e>>>0,h().subarray(e/1,e/1+n)}function y(){return(p===null||p.buffer.detached===!0||p.buffer.detached===void 0&&p.buffer!==c.memory.buffer)&&(p=new DataView(c.memory.buffer)),p}function O(e,n){return e=e>>>0,N(e,n)}function h(){return(m===null||m.byteLength===0)&&(m=new Uint8Array(c.memory.buffer)),m}function o(e){return w[e]}function D(e,n){try{return e.apply(this,n)}catch(t){c.__wbindgen_export3(s(t))}}function g(e){return e==null}function C(e,n,t,r){let i={a:e,b:n,cnt:1,dtor:t},a=(..._)=>{i.cnt++;let f=i.a;i.a=0;try{return r(f,i.b,..._)}finally{i.a=f,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--i.cnt===0&&(i.dtor(i.a,i.b),i.a=0,I.unregister(i))},I.register(a,i,i),a}function b(e,n,t){if(t===void 0){let f=A.encode(e),l=n(f.length,1)>>>0;return h().subarray(l,l+f.length).set(f),u=f.length,l}let r=e.length,i=n(r,1)>>>0,a=h(),_=0;for(;_<r;_++){let f=e.charCodeAt(_);if(f>127)break;a[i+_]=f}if(_!==r){_!==0&&(e=e.slice(_)),i=t(i,r,r=_+e.length*3,1)>>>0;let f=h().subarray(i+_,i+r),l=A.encodeInto(e,f);_+=l.written,i=t(i,r,_,1)>>>0}return u=_,i}function d(e){let n=o(e);return q(e),n}function N(e,n){return E+=n,E>=H&&(W=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),W.decode(),E=n),W.decode(h().subarray(e,e+n))}function v(e,n,t){c.__wasm_bindgen_func_elem_2764(e,n,s(t))}function G(e,n,t,r){c.__wasm_bindgen_func_elem_718(e,n,s(t),s(r))}function Y(e,n){let t=b(e,c.__wbindgen_export,c.__wbindgen_export2),r=u;var i=g(n)?0:b(n,c.__wbindgen_export,c.__wbindgen_export2),a=u;let _=c.definedValues(t,r,i,a);return d(_)}function J(e){let n=b(e,c.__wbindgen_export,c.__wbindgen_export2),t=u,r=c.diagnostics(n,t);return d(r)}function K(e){let n=b(e,c.__wbindgen_export,c.__wbindgen_export2),t=u,r=c.format(n,t);return d(r)}function Q(e,n,t){let r=b(e,c.__wbindgen_export,c.__wbindgen_export2),i=u,a=b(n,c.__wbindgen_export,c.__wbindgen_export2),_=u,f=c.run(r,i,a,_,s(t));return d(f)}function Z(e){let n=b(e,c.__wbindgen_export,c.__wbindgen_export2),t=u,r=c.toAst(n,t);return d(r)}async function ne(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.ok&&ee.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")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",r);else throw r}let t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{let t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function T(){let e={};return e.wbg={},e.wbg.__wbg_Error_52673b7de5a0ca89=function(n,t){let r=Error(O(n,t));return s(r)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(n,t){let r=String(o(t)),i=b(r,c.__wbindgen_export,c.__wbindgen_export2),a=u;y().setInt32(n+4*1,a,!0),y().setInt32(n+4*0,i,!0)},e.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(n){let t=o(n),r=typeof t=="boolean"?t:void 0;return g(r)?16777215:r?1:0},e.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(n,t){let r=M(o(t)),i=b(r,c.__wbindgen_export,c.__wbindgen_export2),a=u;y().setInt32(n+4*1,a,!0),y().setInt32(n+4*0,i,!0)},e.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317=function(n,t){return o(n)in o(t)},e.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(n){return typeof o(n)=="function"},e.wbg.__wbg___wbindgen_is_object_ce774f3490692386=function(n){let t=o(n);return typeof t=="object"&&t!==null},e.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030=function(n){return typeof o(n)=="string"},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(n){return o(n)===void 0},e.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d=function(n,t){return o(n)==o(t)},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(n,t){let r=o(t),i=typeof r=="number"?r:void 0;y().setFloat64(n+8*1,g(i)?0:i,!0),y().setInt32(n+4*0,!g(i),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(n,t){let r=o(t),i=typeof r=="string"?r:void 0;var a=g(i)?0:b(i,c.__wbindgen_export,c.__wbindgen_export2),_=u;y().setInt32(n+4*1,_,!0),y().setInt32(n+4*0,a,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(n,t){throw new Error(O(n,t))},e.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(n){o(n)._wbg_cb_unref()},e.wbg.__wbg_arrayBuffer_3356d392ef2d2aa9=function(n){let t=o(n).arrayBuffer();return s(t)},e.wbg.__wbg_call_3020136f7a2d6e44=function(){return D(function(n,t,r){let i=o(n).call(o(t),o(r));return s(i)},arguments)},e.wbg.__wbg_call_abb4ff46ce38be40=function(){return D(function(n,t){let r=o(n).call(o(t));return s(r)},arguments)},e.wbg.__wbg_done_62ea16af4ce34b24=function(n){return o(n).done},e.wbg.__wbg_entries_7de5c9edd116e219=function(n){let t=o(n).entries();return s(t)},e.wbg.__wbg_entries_83c79938054e065f=function(n){let t=Object.entries(o(n));return s(t)},e.wbg.__wbg_from_29a8414a7a7cd19d=function(n){let t=Array.from(o(n));return s(t)},e.wbg.__wbg_getDirectory_9beed6c83b6861f5=function(n){let t=o(n).getDirectory();return s(t)},e.wbg.__wbg_getFile_3d12eaf635641f3a=function(n){let t=o(n).getFile();return s(t)},e.wbg.__wbg_get_6b7bd52aca3f9671=function(n,t){let r=o(n)[t>>>0];return s(r)},e.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(n,t){let r=o(n)[o(t)];return s(r)},e.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355=function(n){let t;try{t=o(n)instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_instanceof_FileSystemDirectoryHandle_264085cadc86679a=function(n){let t;try{t=o(n)instanceof FileSystemDirectoryHandle}catch{t=!1}return t},e.wbg.__wbg_instanceof_FileSystemFileHandle_214d69e0ae063fc8=function(n){let t;try{t=o(n)instanceof FileSystemFileHandle}catch{t=!1}return t},e.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(n){let t;try{t=o(n)instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(n){let t;try{t=o(n)instanceof Window}catch{t=!1}return t},e.wbg.__wbg_length_22ac23eaec9d8053=function(n){return o(n).length},e.wbg.__wbg_length_d45040a40c570362=function(n){return o(n).length},e.wbg.__wbg_navigator_b49edef831236138=function(n){let t=o(n).navigator;return s(t)},e.wbg.__wbg_new_1ba21ce319a06297=function(){let n=new Object;return s(n)},e.wbg.__wbg_new_25f239778d6112b9=function(){let n=new Array;return s(n)},e.wbg.__wbg_new_6421f6084cc5bc5a=function(n){let t=new Uint8Array(o(n));return s(t)},e.wbg.__wbg_new_ff12d2b041fb48f1=function(n,t){try{var r={a:n,b:t},i=(_,f)=>{let l=r.a;r.a=0;try{return G(l,r.b,_,f)}finally{r.a=l}};let a=new Promise(i);return s(a)}finally{r.a=r.b=0}},e.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(n,t){let r=new Function(O(n,t));return s(r)},e.wbg.__wbg_next_b34c09a202bf4424=function(){return D(function(n){let t=o(n).next();return s(t)},arguments)},e.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(n,t,r){Uint8Array.prototype.set.call($(n,t),o(r))},e.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(n){let t=o(n).queueMicrotask;return s(t)},e.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(n){queueMicrotask(o(n))},e.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(n){let t=Promise.resolve(o(n));return s(t)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(n,t,r){o(n)[d(t)]=d(r)},e.wbg.__wbg_set_7df433eea03a5c14=function(n,t,r){o(n)[t>>>0]=d(r)},e.wbg.__wbg_size_82fbdb656de23326=function(n){return o(n).size},e.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){let n=typeof global>"u"?null:global;return g(n)?0:s(n)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){let n=typeof globalThis>"u"?null:globalThis;return g(n)?0:s(n)},e.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){let n=typeof self>"u"?null:self;return g(n)?0:s(n)},e.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){let n=typeof window>"u"?null:window;return g(n)?0:s(n)},e.wbg.__wbg_storage_b04c3b736f10dd3b=function(n){let t=o(n).storage;return s(t)},e.wbg.__wbg_then_429f7caf1026411d=function(n,t,r){let i=o(n).then(o(t),o(r));return s(i)},e.wbg.__wbg_then_4f95312d68691235=function(n,t){let r=o(n).then(o(t));return s(r)},e.wbg.__wbg_value_57b7b035e117f7ee=function(n){let t=o(n).value;return s(t)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(n,t){let r=O(n,t);return s(r)},e.wbg.__wbindgen_cast_7cc765810adca37d=function(n,t){let r=C(n,t,c.__wasm_bindgen_func_elem_2763,v);return s(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(n){return s(n)},e.wbg.__wbindgen_object_clone_ref=function(n){let t=o(n);return s(t)},e.wbg.__wbindgen_object_drop_ref=function(n){d(n)},e}function k(e,n){return c=e.exports,U.__wbindgen_wasm_module=n,p=null,m=null,c}function te(e){if(c!==void 0)return c;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=T();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let t=new WebAssembly.Instance(e,n);return k(t,e)}async function U(e){if(c!==void 0)return c;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",import.meta.url));let n=T();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await ne(await e,n);return k(t,r)}var c,I,p,m,w,x,W,H,E,A,u,X,S,ee,R,P=B(()=>{"use strict";I=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>e.dtor(e.a,e.b));p=null;m=null;w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);x=w.length;W=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});W.decode();H=2146435072,E=0;A=new TextEncoder;"encodeInto"in A||(A.encodeInto=function(e,n){let t=A.encode(e);return n.set(t),{read:e.length,written:t.length}});u=0;X=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>c.__wbg_runoptions_free(e>>>0,1)),S=class{__destroy_into_raw(){let n=this.__wbg_ptr;return this.__wbg_ptr=0,X.unregister(this),n}free(){let n=this.__destroy_into_raw();c.__wbg_runoptions_free(n,0)}};Symbol.dispose&&(S.prototype[Symbol.dispose]=S.prototype.free);ee=new Set(["basic","cors","default"]);R=U});P();var j=null;async function F(){return j||(await(async()=>{try{await R();let e=await Promise.resolve().then(()=>(P(),V));j={run:e.run,toAst:e.toAst,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),j)}async function _e(e,n,t={}){return await(await F()).run(e,n,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...t})}async function ae(e){return await(await F()).toAst(e)}async function fe(e){return await(await F()).format(e)}async function ue(e){return await(await F()).diagnostics(e)}async function be(e,n){return await(await F()).definedValues(e,n)}export{be as definedValues,ue as diagnostics,fe as format,_e as run,ae as toAst};
1
+ var z=Object.defineProperty;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var B=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})};var V={};B(V,{ConversionOptions:()=>m,RunOptions:()=>O,default:()=>D,definedValues:()=>Q,diagnostics:()=>Z,format:()=>tt,htmlToMarkdown:()=>et,initSync:()=>_t,run:()=>nt,toAst:()=>rt});function s(e){S===d.length&&d.push(d.length+1);let t=S;return S=d[t],d[t]=e,t}function C(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`)}function E(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let o=e.description;return o==null?"Symbol":`Symbol(${o})`}if(t=="function"){let o=e.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(e)){let o=e.length,a="[";o>0&&(a+=E(e[0]));for(let c=1;c<o;c++)a+=", "+E(e[c]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}function q(e){e<132||(d[e]=S,S=e)}function $(e,t){return e=e>>>0,A().subarray(e/1,e/1+t)}function p(){return(y===null||y.buffer.detached===!0||y.buffer.detached===void 0&&y.buffer!==_.memory.buffer)&&(y=new DataView(_.memory.buffer)),y}function M(e,t){return e=e>>>0,G(e,t)}function A(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(_.memory.buffer)),x}function i(e){return d[e]}function W(e,t){try{return e.apply(this,t)}catch(n){_.__wbindgen_export3(s(n))}}function g(e){return e==null}function H(e,t,n,r){let o={a:e,b:t,cnt:1,dtor:n},a=(...c)=>{o.cnt++;let f=o.a;o.a=0;try{return r(f,o.b,...c)}finally{o.a=f,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--o.cnt===0&&(o.dtor(o.a,o.b),o.a=0,P.unregister(o))},P.register(a,o,o),a}function b(e,t,n){if(n===void 0){let f=F.encode(e),l=t(f.length,1)>>>0;return A().subarray(l,l+f.length).set(f),u=f.length,l}let r=e.length,o=t(r,1)>>>0,a=A(),c=0;for(;c<r;c++){let f=e.charCodeAt(c);if(f>127)break;a[o+c]=f}if(c!==r){c!==0&&(e=e.slice(c)),o=n(o,r,r=c+e.length*3,1)>>>0;let f=A().subarray(o+c,o+r),l=F.encodeInto(e,f);c+=l.written,o=n(o,r,c,1)>>>0}return u=c,o}function w(e){let t=i(e);return q(e),t}function G(e,t){return j+=t,j>=N&&(k=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),k.decode(),j=t),k.decode(A().subarray(e,e+t))}function X(e,t,n){_.__wasm_bindgen_func_elem_3018(e,t,s(n))}function Y(e,t,n,r){_.__wasm_bindgen_func_elem_816(e,t,s(n),s(r))}function Q(e,t){let n=b(e,_.__wbindgen_export,_.__wbindgen_export2),r=u;var o=g(t)?0:b(t,_.__wbindgen_export,_.__wbindgen_export2),a=u;let c=_.definedValues(n,r,o,a);return w(c)}function Z(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.diagnostics(t,n);return w(r)}function tt(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.format(t,n);return w(r)}function et(e,t){let n=b(e,_.__wbindgen_export,_.__wbindgen_export2),r=u,o=0;g(t)||(C(t,m),o=t.__destroy_into_raw());let a=_.htmlToMarkdown(n,r,o);return w(a)}function nt(e,t,n){let r=b(e,_.__wbindgen_export,_.__wbindgen_export2),o=u,a=b(t,_.__wbindgen_export,_.__wbindgen_export2),c=u,f=_.run(r,o,a,c,s(n));return w(f)}function rt(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.toAst(t,n);return w(r)}async function it(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.ok&&ot.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")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",r);else throw r}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function I(){let e={};return e.wbg={},e.wbg.__wbg_Error_52673b7de5a0ca89=function(t,n){let r=Error(M(t,n));return s(r)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,n){let r=String(i(n)),o=b(r,_.__wbindgen_export,_.__wbindgen_export2),a=u;p().setInt32(t+4,a,!0),p().setInt32(t+0,o,!0)},e.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(t){let n=i(t),r=typeof n=="boolean"?n:void 0;return g(r)?16777215:r?1:0},e.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(t,n){let r=E(i(n)),o=b(r,_.__wbindgen_export,_.__wbindgen_export2),a=u;p().setInt32(t+4,a,!0),p().setInt32(t+0,o,!0)},e.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317=function(t,n){return i(t)in i(n)},e.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(t){return typeof i(t)=="function"},e.wbg.__wbg___wbindgen_is_object_ce774f3490692386=function(t){let n=i(t);return typeof n=="object"&&n!==null},e.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030=function(t){return typeof i(t)=="string"},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(t){return i(t)===void 0},e.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d=function(t,n){return i(t)==i(n)},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(t,n){let r=i(n),o=typeof r=="number"?r:void 0;p().setFloat64(t+8,g(o)?0:o,!0),p().setInt32(t+0,!g(o),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(t,n){let r=i(n),o=typeof r=="string"?r:void 0;var a=g(o)?0:b(o,_.__wbindgen_export,_.__wbindgen_export2),c=u;p().setInt32(t+4,c,!0),p().setInt32(t+0,a,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(t,n){throw new Error(M(t,n))},e.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(t){i(t)._wbg_cb_unref()},e.wbg.__wbg_arrayBuffer_3356d392ef2d2aa9=function(t){let n=i(t).arrayBuffer();return s(n)},e.wbg.__wbg_call_3020136f7a2d6e44=function(){return W(function(t,n,r){let o=i(t).call(i(n),i(r));return s(o)},arguments)},e.wbg.__wbg_call_abb4ff46ce38be40=function(){return W(function(t,n){let r=i(t).call(i(n));return s(r)},arguments)},e.wbg.__wbg_done_62ea16af4ce34b24=function(t){return i(t).done},e.wbg.__wbg_entries_7de5c9edd116e219=function(t){let n=i(t).entries();return s(n)},e.wbg.__wbg_entries_83c79938054e065f=function(t){let n=Object.entries(i(t));return s(n)},e.wbg.__wbg_from_29a8414a7a7cd19d=function(t){let n=Array.from(i(t));return s(n)},e.wbg.__wbg_getDirectory_9beed6c83b6861f5=function(t){let n=i(t).getDirectory();return s(n)},e.wbg.__wbg_getFile_3d12eaf635641f3a=function(t){let n=i(t).getFile();return s(n)},e.wbg.__wbg_get_6b7bd52aca3f9671=function(t,n){let r=i(t)[n>>>0];return s(r)},e.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(t,n){let r=i(t)[i(n)];return s(r)},e.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355=function(t){let n;try{n=i(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_instanceof_FileSystemDirectoryHandle_264085cadc86679a=function(t){let n;try{n=i(t)instanceof FileSystemDirectoryHandle}catch{n=!1}return n},e.wbg.__wbg_instanceof_FileSystemFileHandle_214d69e0ae063fc8=function(t){let n;try{n=i(t)instanceof FileSystemFileHandle}catch{n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(t){let n;try{n=i(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(t){let n;try{n=i(t)instanceof Window}catch{n=!1}return n},e.wbg.__wbg_length_22ac23eaec9d8053=function(t){return i(t).length},e.wbg.__wbg_length_d45040a40c570362=function(t){return i(t).length},e.wbg.__wbg_navigator_b49edef831236138=function(t){let n=i(t).navigator;return s(n)},e.wbg.__wbg_new_1ba21ce319a06297=function(){let t=new Object;return s(t)},e.wbg.__wbg_new_25f239778d6112b9=function(){let t=new Array;return s(t)},e.wbg.__wbg_new_6421f6084cc5bc5a=function(t){let n=new Uint8Array(i(t));return s(n)},e.wbg.__wbg_new_ff12d2b041fb48f1=function(t,n){try{var r={a:t,b:n},o=(c,f)=>{let l=r.a;r.a=0;try{return Y(l,r.b,c,f)}finally{r.a=l}};let a=new Promise(o);return s(a)}finally{r.a=r.b=0}},e.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(t,n){let r=new Function(M(t,n));return s(r)},e.wbg.__wbg_next_b34c09a202bf4424=function(){return W(function(t){let n=i(t).next();return s(n)},arguments)},e.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(t,n,r){Uint8Array.prototype.set.call($(t,n),i(r))},e.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(t){let n=i(t).queueMicrotask;return s(n)},e.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(t){queueMicrotask(i(t))},e.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(t){let n=Promise.resolve(i(t));return s(n)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,n,r){i(t)[w(n)]=w(r)},e.wbg.__wbg_set_7df433eea03a5c14=function(t,n,r){i(t)[n>>>0]=w(r)},e.wbg.__wbg_size_82fbdb656de23326=function(t){return i(t).size},e.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){let t=typeof global>"u"?null:global;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){let t=typeof globalThis>"u"?null:globalThis;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){let t=typeof self>"u"?null:self;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){let t=typeof window>"u"?null:window;return g(t)?0:s(t)},e.wbg.__wbg_storage_b04c3b736f10dd3b=function(t){let n=i(t).storage;return s(n)},e.wbg.__wbg_then_429f7caf1026411d=function(t,n,r){let o=i(t).then(i(n),i(r));return s(o)},e.wbg.__wbg_then_4f95312d68691235=function(t,n){let r=i(t).then(i(n));return s(r)},e.wbg.__wbg_value_57b7b035e117f7ee=function(t){let n=i(t).value;return s(n)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(t,n){let r=M(t,n);return s(r)},e.wbg.__wbindgen_cast_29480d6a48b8e833=function(t,n){let r=H(t,n,_.__wasm_bindgen_func_elem_3017,X);return s(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(t){return s(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let n=i(t);return s(n)},e.wbg.__wbindgen_object_drop_ref=function(t){w(t)},e}function v(e,t){return _=e.exports,U.__wbindgen_wasm_module=t,y=null,x=null,_}function _t(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=I();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return v(n,e)}async function U(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",import.meta.url));let t=I();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await it(await e,t);return v(n,r)}var _,P,y,x,d,S,k,N,j,F,u,J,K,m,O,ot,D,R=L(()=>{"use strict";P=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>e.dtor(e.a,e.b));y=null;x=null;d=new Array(128).fill(void 0);d.push(void 0,null,!0,!1);S=d.length;k=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});k.decode();N=2146435072,j=0;F=new TextEncoder;"encodeInto"in F||(F.encodeInto=function(e,t){let n=F.encode(e);return t.set(n),{read:e.length,written:n.length}});u=0;J=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_conversionoptions_free(e>>>0,1)),K=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_runoptions_free(e>>>0,1)),m=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,J.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_conversionoptions_free(t,0)}get extract_scripts_as_code_blocks(){return _.__wbg_get_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr)!==0}set extract_scripts_as_code_blocks(t){_.__wbg_set_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr,t)}get generate_front_matter(){return _.__wbg_get_conversionoptions_generate_front_matter(this.__wbg_ptr)!==0}set generate_front_matter(t){_.__wbg_set_conversionoptions_generate_front_matter(this.__wbg_ptr,t)}get use_title_as_h1(){return _.__wbg_get_conversionoptions_use_title_as_h1(this.__wbg_ptr)!==0}set use_title_as_h1(t){_.__wbg_set_conversionoptions_use_title_as_h1(this.__wbg_ptr,t)}};Symbol.dispose&&(m.prototype[Symbol.dispose]=m.prototype.free);O=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,K.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_runoptions_free(t,0)}};Symbol.dispose&&(O.prototype[Symbol.dispose]=O.prototype.free);ot=new Set(["basic","cors","default"]);D=U});R();var T=null;async function h(){return T||(await(async()=>{try{await D();let e=await Promise.resolve().then(()=>(R(),V));T={run:e.run,toAst:e.toAst,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues,htmlToMarkdown:e.htmlToMarkdown}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),T)}async function gt(e,t,n={}){return await(await h()).run(e,t,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...n})}async function wt(e){return await(await h()).toAst(e)}async function dt(e){return await(await h()).format(e)}async function lt(e){return await(await h()).diagnostics(e)}async function pt(e,t){return await(await h()).definedValues(e,t)}async function yt(e,t){return await(await h()).htmlToMarkdown(e,t)}export{pt as definedValues,lt as diagnostics,dt as format,yt as htmlToMarkdown,gt as run,wt as toAst};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var W=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var X=(e,n)=>()=>(e&&(n=e(e=0)),n);var T=(e,n)=>{for(var t in n)W(e,t,{get:n[t],enumerable:!0})},Y=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of v(n))!G.call(e,i)&&i!==t&&W(e,i,{get:()=>n[i],enumerable:!(r=N(n,i))||r.enumerable});return e};var J=e=>Y(W({},"__esModule",{value:!0}),e);var q={};T(q,{RunOptions:()=>S,default:()=>P,definedValues:()=>oe,diagnostics:()=>se,format:()=>ce,initSync:()=>be,run:()=>_e,toAst:()=>ae});function c(e){x===w.length&&w.push(w.length+1);let n=x;return x=w[n],w[n]=e,n}function R(e){let n=typeof e;if(n=="number"||n=="boolean"||e==null)return`${e}`;if(n=="string")return`"${e}"`;if(n=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(n=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,a="[";i>0&&(a+=R(e[0]));for(let _=1;_<i;_++)a+=", "+R(e[_]);return a+="]",a}let t=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(t&&t.length>1)r=t[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
- ${e.stack}`:r}function K(e){e<132||(w[e]=x,x=e)}function Q(e,n){return e=e>>>0,h().subarray(e/1,e/1+n)}function y(){return(p===null||p.buffer.detached===!0||p.buffer.detached===void 0&&p.buffer!==s.memory.buffer)&&(p=new DataView(s.memory.buffer)),p}function O(e,n){return e=e>>>0,ne(e,n)}function h(){return(m===null||m.byteLength===0)&&(m=new Uint8Array(s.memory.buffer)),m}function o(e){return w[e]}function E(e,n){try{return e.apply(this,n)}catch(t){s.__wbindgen_export3(c(t))}}function g(e){return e==null}function Z(e,n,t,r){let i={a:e,b:n,cnt:1,dtor:t},a=(..._)=>{i.cnt++;let f=i.a;i.a=0;try{return r(f,i.b,..._)}finally{i.a=f,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--i.cnt===0&&(i.dtor(i.a,i.b),i.a=0,V.unregister(i))},V.register(a,i,i),a}function b(e,n,t){if(t===void 0){let f=A.encode(e),l=n(f.length,1)>>>0;return h().subarray(l,l+f.length).set(f),u=f.length,l}let r=e.length,i=n(r,1)>>>0,a=h(),_=0;for(;_<r;_++){let f=e.charCodeAt(_);if(f>127)break;a[i+_]=f}if(_!==r){_!==0&&(e=e.slice(_)),i=t(i,r,r=_+e.length*3,1)>>>0;let f=h().subarray(i+_,i+r),l=A.encodeInto(e,f);_+=l.written,i=t(i,r,_,1)>>>0}return u=_,i}function d(e){let n=o(e);return K(e),n}function ne(e,n){return M+=n,M>=ee&&(D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),D.decode(),M=n),D.decode(h().subarray(e,e+n))}function te(e,n,t){s.__wasm_bindgen_func_elem_2764(e,n,c(t))}function re(e,n,t,r){s.__wasm_bindgen_func_elem_718(e,n,c(t),c(r))}function oe(e,n){let t=b(e,s.__wbindgen_export,s.__wbindgen_export2),r=u;var i=g(n)?0:b(n,s.__wbindgen_export,s.__wbindgen_export2),a=u;let _=s.definedValues(t,r,i,a);return d(_)}function se(e){let n=b(e,s.__wbindgen_export,s.__wbindgen_export2),t=u,r=s.diagnostics(n,t);return d(r)}function ce(e){let n=b(e,s.__wbindgen_export,s.__wbindgen_export2),t=u,r=s.format(n,t);return d(r)}function _e(e,n,t){let r=b(e,s.__wbindgen_export,s.__wbindgen_export2),i=u,a=b(n,s.__wbindgen_export,s.__wbindgen_export2),_=u,f=s.run(r,i,a,_,c(t));return d(f)}function ae(e){let n=b(e,s.__wbindgen_export,s.__wbindgen_export2),t=u,r=s.toAst(n,t);return d(r)}async function ue(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.ok&&fe.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")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",r);else throw r}let t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{let t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function k(){let e={};return e.wbg={},e.wbg.__wbg_Error_52673b7de5a0ca89=function(n,t){let r=Error(O(n,t));return c(r)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(n,t){let r=String(o(t)),i=b(r,s.__wbindgen_export,s.__wbindgen_export2),a=u;y().setInt32(n+4*1,a,!0),y().setInt32(n+4*0,i,!0)},e.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(n){let t=o(n),r=typeof t=="boolean"?t:void 0;return g(r)?16777215:r?1:0},e.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(n,t){let r=R(o(t)),i=b(r,s.__wbindgen_export,s.__wbindgen_export2),a=u;y().setInt32(n+4*1,a,!0),y().setInt32(n+4*0,i,!0)},e.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317=function(n,t){return o(n)in o(t)},e.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(n){return typeof o(n)=="function"},e.wbg.__wbg___wbindgen_is_object_ce774f3490692386=function(n){let t=o(n);return typeof t=="object"&&t!==null},e.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030=function(n){return typeof o(n)=="string"},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(n){return o(n)===void 0},e.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d=function(n,t){return o(n)==o(t)},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(n,t){let r=o(t),i=typeof r=="number"?r:void 0;y().setFloat64(n+8*1,g(i)?0:i,!0),y().setInt32(n+4*0,!g(i),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(n,t){let r=o(t),i=typeof r=="string"?r:void 0;var a=g(i)?0:b(i,s.__wbindgen_export,s.__wbindgen_export2),_=u;y().setInt32(n+4*1,_,!0),y().setInt32(n+4*0,a,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(n,t){throw new Error(O(n,t))},e.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(n){o(n)._wbg_cb_unref()},e.wbg.__wbg_arrayBuffer_3356d392ef2d2aa9=function(n){let t=o(n).arrayBuffer();return c(t)},e.wbg.__wbg_call_3020136f7a2d6e44=function(){return E(function(n,t,r){let i=o(n).call(o(t),o(r));return c(i)},arguments)},e.wbg.__wbg_call_abb4ff46ce38be40=function(){return E(function(n,t){let r=o(n).call(o(t));return c(r)},arguments)},e.wbg.__wbg_done_62ea16af4ce34b24=function(n){return o(n).done},e.wbg.__wbg_entries_7de5c9edd116e219=function(n){let t=o(n).entries();return c(t)},e.wbg.__wbg_entries_83c79938054e065f=function(n){let t=Object.entries(o(n));return c(t)},e.wbg.__wbg_from_29a8414a7a7cd19d=function(n){let t=Array.from(o(n));return c(t)},e.wbg.__wbg_getDirectory_9beed6c83b6861f5=function(n){let t=o(n).getDirectory();return c(t)},e.wbg.__wbg_getFile_3d12eaf635641f3a=function(n){let t=o(n).getFile();return c(t)},e.wbg.__wbg_get_6b7bd52aca3f9671=function(n,t){let r=o(n)[t>>>0];return c(r)},e.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(n,t){let r=o(n)[o(t)];return c(r)},e.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355=function(n){let t;try{t=o(n)instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_instanceof_FileSystemDirectoryHandle_264085cadc86679a=function(n){let t;try{t=o(n)instanceof FileSystemDirectoryHandle}catch{t=!1}return t},e.wbg.__wbg_instanceof_FileSystemFileHandle_214d69e0ae063fc8=function(n){let t;try{t=o(n)instanceof FileSystemFileHandle}catch{t=!1}return t},e.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(n){let t;try{t=o(n)instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(n){let t;try{t=o(n)instanceof Window}catch{t=!1}return t},e.wbg.__wbg_length_22ac23eaec9d8053=function(n){return o(n).length},e.wbg.__wbg_length_d45040a40c570362=function(n){return o(n).length},e.wbg.__wbg_navigator_b49edef831236138=function(n){let t=o(n).navigator;return c(t)},e.wbg.__wbg_new_1ba21ce319a06297=function(){let n=new Object;return c(n)},e.wbg.__wbg_new_25f239778d6112b9=function(){let n=new Array;return c(n)},e.wbg.__wbg_new_6421f6084cc5bc5a=function(n){let t=new Uint8Array(o(n));return c(t)},e.wbg.__wbg_new_ff12d2b041fb48f1=function(n,t){try{var r={a:n,b:t},i=(_,f)=>{let l=r.a;r.a=0;try{return re(l,r.b,_,f)}finally{r.a=l}};let a=new Promise(i);return c(a)}finally{r.a=r.b=0}},e.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(n,t){let r=new Function(O(n,t));return c(r)},e.wbg.__wbg_next_b34c09a202bf4424=function(){return E(function(n){let t=o(n).next();return c(t)},arguments)},e.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(n,t,r){Uint8Array.prototype.set.call(Q(n,t),o(r))},e.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(n){let t=o(n).queueMicrotask;return c(t)},e.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(n){queueMicrotask(o(n))},e.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(n){let t=Promise.resolve(o(n));return c(t)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(n,t,r){o(n)[d(t)]=d(r)},e.wbg.__wbg_set_7df433eea03a5c14=function(n,t,r){o(n)[t>>>0]=d(r)},e.wbg.__wbg_size_82fbdb656de23326=function(n){return o(n).size},e.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){let n=typeof global>"u"?null:global;return g(n)?0:c(n)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){let n=typeof globalThis>"u"?null:globalThis;return g(n)?0:c(n)},e.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){let n=typeof self>"u"?null:self;return g(n)?0:c(n)},e.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){let n=typeof window>"u"?null:window;return g(n)?0:c(n)},e.wbg.__wbg_storage_b04c3b736f10dd3b=function(n){let t=o(n).storage;return c(t)},e.wbg.__wbg_then_429f7caf1026411d=function(n,t,r){let i=o(n).then(o(t),o(r));return c(i)},e.wbg.__wbg_then_4f95312d68691235=function(n,t){let r=o(n).then(o(t));return c(r)},e.wbg.__wbg_value_57b7b035e117f7ee=function(n){let t=o(n).value;return c(t)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(n,t){let r=O(n,t);return c(r)},e.wbg.__wbindgen_cast_7cc765810adca37d=function(n,t){let r=Z(n,t,s.__wasm_bindgen_func_elem_2763,te);return c(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(n){return c(n)},e.wbg.__wbindgen_object_clone_ref=function(n){let t=o(n);return c(t)},e.wbg.__wbindgen_object_drop_ref=function(n){d(n)},e}function U(e,n){return s=e.exports,L.__wbindgen_wasm_module=n,p=null,m=null,s}function be(e){if(s!==void 0)return s;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=k();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let t=new WebAssembly.Instance(e,n);return U(t,e)}async function L(e){if(s!==void 0)return s;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",ge.url));let n=k();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await ue(await e,n);return U(t,r)}var ge,s,V,p,m,w,x,D,ee,M,A,u,ie,S,fe,P,I=X(()=>{"use strict";ge={};V=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>e.dtor(e.a,e.b));p=null;m=null;w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);x=w.length;D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});D.decode();ee=2146435072,M=0;A=new TextEncoder;"encodeInto"in A||(A.encodeInto=function(e,n){let t=A.encode(e);return n.set(t),{read:e.length,written:t.length}});u=0;ie=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>s.__wbg_runoptions_free(e>>>0,1)),S=class{__destroy_into_raw(){let n=this.__wbg_ptr;return this.__wbg_ptr=0,ie.unregister(this),n}free(){let n=this.__destroy_into_raw();s.__wbg_runoptions_free(n,0)}};Symbol.dispose&&(S.prototype[Symbol.dispose]=S.prototype.free);fe=new Set(["basic","cors","default"]);P=L});var we={};T(we,{definedValues:()=>H,diagnostics:()=>C,format:()=>$,run:()=>B,toAst:()=>z});module.exports=J(we);I();var j=null;async function F(){return j||(await(async()=>{try{await P();let e=await Promise.resolve().then(()=>(I(),q));j={run:e.run,toAst:e.toAst,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),j)}async function B(e,n,t={}){return await(await F()).run(e,n,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...t})}async function z(e){return await(await F()).toAst(e)}async function $(e){return await(await F()).format(e)}async function C(e){return await(await F()).diagnostics(e)}async function H(e,n){return await(await F()).definedValues(e,n)}0&&(module.exports={definedValues,diagnostics,format,run,toAst});
1
+ "use strict";var T=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var Y=(e,t)=>()=>(e&&(t=e(e=0)),t);var I=(e,t)=>{for(var n in t)T(e,n,{get:t[n],enumerable:!0})},J=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!X.call(e,o)&&o!==n&&T(e,o,{get:()=>t[o],enumerable:!(r=N(t,o))||r.enumerable});return e};var K=e=>J(T({},"__esModule",{value:!0}),e);var L={};I(L,{ConversionOptions:()=>m,RunOptions:()=>F,default:()=>R,definedValues:()=>ct,diagnostics:()=>at,format:()=>ft,htmlToMarkdown:()=>ut,initSync:()=>lt,run:()=>bt,toAst:()=>gt});function s(e){A===d.length&&d.push(d.length+1);let t=A;return A=d[t],d[t]=e,t}function Q(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`)}function E(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let o=e.description;return o==null?"Symbol":`Symbol(${o})`}if(t=="function"){let o=e.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(e)){let o=e.length,a="[";o>0&&(a+=E(e[0]));for(let c=1;c<o;c++)a+=", "+E(e[c]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}function Z(e){e<132||(d[e]=A,A=e)}function tt(e,t){return e=e>>>0,x().subarray(e/1,e/1+t)}function p(){return(y===null||y.buffer.detached===!0||y.buffer.detached===void 0&&y.buffer!==_.memory.buffer)&&(y=new DataView(_.memory.buffer)),y}function M(e,t){return e=e>>>0,rt(e,t)}function x(){return(h===null||h.byteLength===0)&&(h=new Uint8Array(_.memory.buffer)),h}function i(e){return d[e]}function j(e,t){try{return e.apply(this,t)}catch(n){_.__wbindgen_export3(s(n))}}function g(e){return e==null}function et(e,t,n,r){let o={a:e,b:t,cnt:1,dtor:n},a=(...c)=>{o.cnt++;let f=o.a;o.a=0;try{return r(f,o.b,...c)}finally{o.a=f,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--o.cnt===0&&(o.dtor(o.a,o.b),o.a=0,V.unregister(o))},V.register(a,o,o),a}function b(e,t,n){if(n===void 0){let f=S.encode(e),l=t(f.length,1)>>>0;return x().subarray(l,l+f.length).set(f),u=f.length,l}let r=e.length,o=t(r,1)>>>0,a=x(),c=0;for(;c<r;c++){let f=e.charCodeAt(c);if(f>127)break;a[o+c]=f}if(c!==r){c!==0&&(e=e.slice(c)),o=n(o,r,r=c+e.length*3,1)>>>0;let f=x().subarray(o+c,o+r),l=S.encodeInto(e,f);c+=l.written,o=n(o,r,c,1)>>>0}return u=c,o}function w(e){let t=i(e);return Z(e),t}function rt(e,t){return W+=t,W>=nt&&(k=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),k.decode(),W=t),k.decode(x().subarray(e,e+t))}function ot(e,t,n){_.__wasm_bindgen_func_elem_3018(e,t,s(n))}function it(e,t,n,r){_.__wasm_bindgen_func_elem_816(e,t,s(n),s(r))}function ct(e,t){let n=b(e,_.__wbindgen_export,_.__wbindgen_export2),r=u;var o=g(t)?0:b(t,_.__wbindgen_export,_.__wbindgen_export2),a=u;let c=_.definedValues(n,r,o,a);return w(c)}function at(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.diagnostics(t,n);return w(r)}function ft(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.format(t,n);return w(r)}function ut(e,t){let n=b(e,_.__wbindgen_export,_.__wbindgen_export2),r=u,o=0;g(t)||(Q(t,m),o=t.__destroy_into_raw());let a=_.htmlToMarkdown(n,r,o);return w(a)}function bt(e,t,n){let r=b(e,_.__wbindgen_export,_.__wbindgen_export2),o=u,a=b(t,_.__wbindgen_export,_.__wbindgen_export2),c=u,f=_.run(r,o,a,c,s(n));return w(f)}function gt(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.toAst(t,n);return w(r)}async function dt(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.ok&&wt.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")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",r);else throw r}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function v(){let e={};return e.wbg={},e.wbg.__wbg_Error_52673b7de5a0ca89=function(t,n){let r=Error(M(t,n));return s(r)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,n){let r=String(i(n)),o=b(r,_.__wbindgen_export,_.__wbindgen_export2),a=u;p().setInt32(t+4,a,!0),p().setInt32(t+0,o,!0)},e.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(t){let n=i(t),r=typeof n=="boolean"?n:void 0;return g(r)?16777215:r?1:0},e.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(t,n){let r=E(i(n)),o=b(r,_.__wbindgen_export,_.__wbindgen_export2),a=u;p().setInt32(t+4,a,!0),p().setInt32(t+0,o,!0)},e.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317=function(t,n){return i(t)in i(n)},e.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(t){return typeof i(t)=="function"},e.wbg.__wbg___wbindgen_is_object_ce774f3490692386=function(t){let n=i(t);return typeof n=="object"&&n!==null},e.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030=function(t){return typeof i(t)=="string"},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(t){return i(t)===void 0},e.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d=function(t,n){return i(t)==i(n)},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(t,n){let r=i(n),o=typeof r=="number"?r:void 0;p().setFloat64(t+8,g(o)?0:o,!0),p().setInt32(t+0,!g(o),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(t,n){let r=i(n),o=typeof r=="string"?r:void 0;var a=g(o)?0:b(o,_.__wbindgen_export,_.__wbindgen_export2),c=u;p().setInt32(t+4,c,!0),p().setInt32(t+0,a,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(t,n){throw new Error(M(t,n))},e.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(t){i(t)._wbg_cb_unref()},e.wbg.__wbg_arrayBuffer_3356d392ef2d2aa9=function(t){let n=i(t).arrayBuffer();return s(n)},e.wbg.__wbg_call_3020136f7a2d6e44=function(){return j(function(t,n,r){let o=i(t).call(i(n),i(r));return s(o)},arguments)},e.wbg.__wbg_call_abb4ff46ce38be40=function(){return j(function(t,n){let r=i(t).call(i(n));return s(r)},arguments)},e.wbg.__wbg_done_62ea16af4ce34b24=function(t){return i(t).done},e.wbg.__wbg_entries_7de5c9edd116e219=function(t){let n=i(t).entries();return s(n)},e.wbg.__wbg_entries_83c79938054e065f=function(t){let n=Object.entries(i(t));return s(n)},e.wbg.__wbg_from_29a8414a7a7cd19d=function(t){let n=Array.from(i(t));return s(n)},e.wbg.__wbg_getDirectory_9beed6c83b6861f5=function(t){let n=i(t).getDirectory();return s(n)},e.wbg.__wbg_getFile_3d12eaf635641f3a=function(t){let n=i(t).getFile();return s(n)},e.wbg.__wbg_get_6b7bd52aca3f9671=function(t,n){let r=i(t)[n>>>0];return s(r)},e.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(t,n){let r=i(t)[i(n)];return s(r)},e.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355=function(t){let n;try{n=i(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_instanceof_FileSystemDirectoryHandle_264085cadc86679a=function(t){let n;try{n=i(t)instanceof FileSystemDirectoryHandle}catch{n=!1}return n},e.wbg.__wbg_instanceof_FileSystemFileHandle_214d69e0ae063fc8=function(t){let n;try{n=i(t)instanceof FileSystemFileHandle}catch{n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(t){let n;try{n=i(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(t){let n;try{n=i(t)instanceof Window}catch{n=!1}return n},e.wbg.__wbg_length_22ac23eaec9d8053=function(t){return i(t).length},e.wbg.__wbg_length_d45040a40c570362=function(t){return i(t).length},e.wbg.__wbg_navigator_b49edef831236138=function(t){let n=i(t).navigator;return s(n)},e.wbg.__wbg_new_1ba21ce319a06297=function(){let t=new Object;return s(t)},e.wbg.__wbg_new_25f239778d6112b9=function(){let t=new Array;return s(t)},e.wbg.__wbg_new_6421f6084cc5bc5a=function(t){let n=new Uint8Array(i(t));return s(n)},e.wbg.__wbg_new_ff12d2b041fb48f1=function(t,n){try{var r={a:t,b:n},o=(c,f)=>{let l=r.a;r.a=0;try{return it(l,r.b,c,f)}finally{r.a=l}};let a=new Promise(o);return s(a)}finally{r.a=r.b=0}},e.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(t,n){let r=new Function(M(t,n));return s(r)},e.wbg.__wbg_next_b34c09a202bf4424=function(){return j(function(t){let n=i(t).next();return s(n)},arguments)},e.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(t,n,r){Uint8Array.prototype.set.call(tt(t,n),i(r))},e.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(t){let n=i(t).queueMicrotask;return s(n)},e.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(t){queueMicrotask(i(t))},e.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(t){let n=Promise.resolve(i(t));return s(n)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,n,r){i(t)[w(n)]=w(r)},e.wbg.__wbg_set_7df433eea03a5c14=function(t,n,r){i(t)[n>>>0]=w(r)},e.wbg.__wbg_size_82fbdb656de23326=function(t){return i(t).size},e.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){let t=typeof global>"u"?null:global;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){let t=typeof globalThis>"u"?null:globalThis;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){let t=typeof self>"u"?null:self;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){let t=typeof window>"u"?null:window;return g(t)?0:s(t)},e.wbg.__wbg_storage_b04c3b736f10dd3b=function(t){let n=i(t).storage;return s(n)},e.wbg.__wbg_then_429f7caf1026411d=function(t,n,r){let o=i(t).then(i(n),i(r));return s(o)},e.wbg.__wbg_then_4f95312d68691235=function(t,n){let r=i(t).then(i(n));return s(r)},e.wbg.__wbg_value_57b7b035e117f7ee=function(t){let n=i(t).value;return s(n)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(t,n){let r=M(t,n);return s(r)},e.wbg.__wbindgen_cast_29480d6a48b8e833=function(t,n){let r=et(t,n,_.__wasm_bindgen_func_elem_3017,ot);return s(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(t){return s(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let n=i(t);return s(n)},e.wbg.__wbindgen_object_drop_ref=function(t){w(t)},e}function U(e,t){return _=e.exports,z.__wbindgen_wasm_module=t,y=null,h=null,_}function lt(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=v();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return U(n,e)}async function z(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",pt.url));let t=v();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await dt(await e,t);return U(n,r)}var pt,_,V,y,h,d,A,k,nt,W,S,u,_t,st,m,F,wt,R,P=Y(()=>{"use strict";pt={};V=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>e.dtor(e.a,e.b));y=null;h=null;d=new Array(128).fill(void 0);d.push(void 0,null,!0,!1);A=d.length;k=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});k.decode();nt=2146435072,W=0;S=new TextEncoder;"encodeInto"in S||(S.encodeInto=function(e,t){let n=S.encode(e);return t.set(n),{read:e.length,written:n.length}});u=0;_t=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_conversionoptions_free(e>>>0,1)),st=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_runoptions_free(e>>>0,1)),m=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,_t.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_conversionoptions_free(t,0)}get extract_scripts_as_code_blocks(){return _.__wbg_get_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr)!==0}set extract_scripts_as_code_blocks(t){_.__wbg_set_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr,t)}get generate_front_matter(){return _.__wbg_get_conversionoptions_generate_front_matter(this.__wbg_ptr)!==0}set generate_front_matter(t){_.__wbg_set_conversionoptions_generate_front_matter(this.__wbg_ptr,t)}get use_title_as_h1(){return _.__wbg_get_conversionoptions_use_title_as_h1(this.__wbg_ptr)!==0}set use_title_as_h1(t){_.__wbg_set_conversionoptions_use_title_as_h1(this.__wbg_ptr,t)}};Symbol.dispose&&(m.prototype[Symbol.dispose]=m.prototype.free);F=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,st.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_runoptions_free(t,0)}};Symbol.dispose&&(F.prototype[Symbol.dispose]=F.prototype.free);wt=new Set(["basic","cors","default"]);R=z});var yt={};I(yt,{definedValues:()=>H,diagnostics:()=>$,format:()=>C,run:()=>q,toAst:()=>B});module.exports=K(yt);P();var D=null;async function O(){return D||(await(async()=>{try{await R();let e=await Promise.resolve().then(()=>(P(),L));D={run:e.run,toAst:e.toAst,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues,htmlToMarkdown:e.htmlToMarkdown}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),D)}async function q(e,t,n={}){return await(await O()).run(e,t,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...n})}async function B(e){return await(await O()).toAst(e)}async function C(e){return await(await O()).format(e)}async function $(e){return await(await O()).diagnostics(e)}async function H(e,t){return await(await O()).definedValues(e,t)}0&&(module.exports={definedValues,diagnostics,format,run,toAst});
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var L=Object.defineProperty;var q=(e,n)=>()=>(e&&(n=e(e=0)),n);var B=(e,n)=>{for(var t in n)L(e,t,{get:n[t],enumerable:!0})};var U={};B(U,{RunOptions:()=>S,default:()=>R,definedValues:()=>Y,diagnostics:()=>J,format:()=>K,initSync:()=>te,run:()=>Q,toAst:()=>Z});function c(e){x===w.length&&w.push(w.length+1);let n=x;return x=w[n],w[n]=e,n}function M(e){let n=typeof e;if(n=="number"||n=="boolean"||e==null)return`${e}`;if(n=="string")return`"${e}"`;if(n=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(n=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,a="[";i>0&&(a+=M(e[0]));for(let _=1;_<i;_++)a+=", "+M(e[_]);return a+="]",a}let t=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(t&&t.length>1)r=t[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
- ${e.stack}`:r}function z(e){e<132||(w[e]=x,x=e)}function $(e,n){return e=e>>>0,h().subarray(e/1,e/1+n)}function y(){return(p===null||p.buffer.detached===!0||p.buffer.detached===void 0&&p.buffer!==s.memory.buffer)&&(p=new DataView(s.memory.buffer)),p}function O(e,n){return e=e>>>0,N(e,n)}function h(){return(m===null||m.byteLength===0)&&(m=new Uint8Array(s.memory.buffer)),m}function o(e){return w[e]}function W(e,n){try{return e.apply(this,n)}catch(t){s.__wbindgen_export3(c(t))}}function g(e){return e==null}function C(e,n,t,r){let i={a:e,b:n,cnt:1,dtor:t},a=(..._)=>{i.cnt++;let f=i.a;i.a=0;try{return r(f,i.b,..._)}finally{i.a=f,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--i.cnt===0&&(i.dtor(i.a,i.b),i.a=0,I.unregister(i))},I.register(a,i,i),a}function b(e,n,t){if(t===void 0){let f=A.encode(e),l=n(f.length,1)>>>0;return h().subarray(l,l+f.length).set(f),u=f.length,l}let r=e.length,i=n(r,1)>>>0,a=h(),_=0;for(;_<r;_++){let f=e.charCodeAt(_);if(f>127)break;a[i+_]=f}if(_!==r){_!==0&&(e=e.slice(_)),i=t(i,r,r=_+e.length*3,1)>>>0;let f=h().subarray(i+_,i+r),l=A.encodeInto(e,f);_+=l.written,i=t(i,r,_,1)>>>0}return u=_,i}function d(e){let n=o(e);return z(e),n}function N(e,n){return E+=n,E>=H&&(D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),D.decode(),E=n),D.decode(h().subarray(e,e+n))}function v(e,n,t){s.__wasm_bindgen_func_elem_2764(e,n,c(t))}function G(e,n,t,r){s.__wasm_bindgen_func_elem_718(e,n,c(t),c(r))}function Y(e,n){let t=b(e,s.__wbindgen_export,s.__wbindgen_export2),r=u;var i=g(n)?0:b(n,s.__wbindgen_export,s.__wbindgen_export2),a=u;let _=s.definedValues(t,r,i,a);return d(_)}function J(e){let n=b(e,s.__wbindgen_export,s.__wbindgen_export2),t=u,r=s.diagnostics(n,t);return d(r)}function K(e){let n=b(e,s.__wbindgen_export,s.__wbindgen_export2),t=u,r=s.format(n,t);return d(r)}function Q(e,n,t){let r=b(e,s.__wbindgen_export,s.__wbindgen_export2),i=u,a=b(n,s.__wbindgen_export,s.__wbindgen_export2),_=u,f=s.run(r,i,a,_,c(t));return d(f)}function Z(e){let n=b(e,s.__wbindgen_export,s.__wbindgen_export2),t=u,r=s.toAst(n,t);return d(r)}async function ne(e,n){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(r){if(e.ok&&ee.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")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",r);else throw r}let t=await e.arrayBuffer();return await WebAssembly.instantiate(t,n)}else{let t=await WebAssembly.instantiate(e,n);return t instanceof WebAssembly.Instance?{instance:t,module:e}:t}}function T(){let e={};return e.wbg={},e.wbg.__wbg_Error_52673b7de5a0ca89=function(n,t){let r=Error(O(n,t));return c(r)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(n,t){let r=String(o(t)),i=b(r,s.__wbindgen_export,s.__wbindgen_export2),a=u;y().setInt32(n+4*1,a,!0),y().setInt32(n+4*0,i,!0)},e.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(n){let t=o(n),r=typeof t=="boolean"?t:void 0;return g(r)?16777215:r?1:0},e.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(n,t){let r=M(o(t)),i=b(r,s.__wbindgen_export,s.__wbindgen_export2),a=u;y().setInt32(n+4*1,a,!0),y().setInt32(n+4*0,i,!0)},e.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317=function(n,t){return o(n)in o(t)},e.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(n){return typeof o(n)=="function"},e.wbg.__wbg___wbindgen_is_object_ce774f3490692386=function(n){let t=o(n);return typeof t=="object"&&t!==null},e.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030=function(n){return typeof o(n)=="string"},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(n){return o(n)===void 0},e.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d=function(n,t){return o(n)==o(t)},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(n,t){let r=o(t),i=typeof r=="number"?r:void 0;y().setFloat64(n+8*1,g(i)?0:i,!0),y().setInt32(n+4*0,!g(i),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(n,t){let r=o(t),i=typeof r=="string"?r:void 0;var a=g(i)?0:b(i,s.__wbindgen_export,s.__wbindgen_export2),_=u;y().setInt32(n+4*1,_,!0),y().setInt32(n+4*0,a,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(n,t){throw new Error(O(n,t))},e.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(n){o(n)._wbg_cb_unref()},e.wbg.__wbg_arrayBuffer_3356d392ef2d2aa9=function(n){let t=o(n).arrayBuffer();return c(t)},e.wbg.__wbg_call_3020136f7a2d6e44=function(){return W(function(n,t,r){let i=o(n).call(o(t),o(r));return c(i)},arguments)},e.wbg.__wbg_call_abb4ff46ce38be40=function(){return W(function(n,t){let r=o(n).call(o(t));return c(r)},arguments)},e.wbg.__wbg_done_62ea16af4ce34b24=function(n){return o(n).done},e.wbg.__wbg_entries_7de5c9edd116e219=function(n){let t=o(n).entries();return c(t)},e.wbg.__wbg_entries_83c79938054e065f=function(n){let t=Object.entries(o(n));return c(t)},e.wbg.__wbg_from_29a8414a7a7cd19d=function(n){let t=Array.from(o(n));return c(t)},e.wbg.__wbg_getDirectory_9beed6c83b6861f5=function(n){let t=o(n).getDirectory();return c(t)},e.wbg.__wbg_getFile_3d12eaf635641f3a=function(n){let t=o(n).getFile();return c(t)},e.wbg.__wbg_get_6b7bd52aca3f9671=function(n,t){let r=o(n)[t>>>0];return c(r)},e.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(n,t){let r=o(n)[o(t)];return c(r)},e.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355=function(n){let t;try{t=o(n)instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_instanceof_FileSystemDirectoryHandle_264085cadc86679a=function(n){let t;try{t=o(n)instanceof FileSystemDirectoryHandle}catch{t=!1}return t},e.wbg.__wbg_instanceof_FileSystemFileHandle_214d69e0ae063fc8=function(n){let t;try{t=o(n)instanceof FileSystemFileHandle}catch{t=!1}return t},e.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(n){let t;try{t=o(n)instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(n){let t;try{t=o(n)instanceof Window}catch{t=!1}return t},e.wbg.__wbg_length_22ac23eaec9d8053=function(n){return o(n).length},e.wbg.__wbg_length_d45040a40c570362=function(n){return o(n).length},e.wbg.__wbg_navigator_b49edef831236138=function(n){let t=o(n).navigator;return c(t)},e.wbg.__wbg_new_1ba21ce319a06297=function(){let n=new Object;return c(n)},e.wbg.__wbg_new_25f239778d6112b9=function(){let n=new Array;return c(n)},e.wbg.__wbg_new_6421f6084cc5bc5a=function(n){let t=new Uint8Array(o(n));return c(t)},e.wbg.__wbg_new_ff12d2b041fb48f1=function(n,t){try{var r={a:n,b:t},i=(_,f)=>{let l=r.a;r.a=0;try{return G(l,r.b,_,f)}finally{r.a=l}};let a=new Promise(i);return c(a)}finally{r.a=r.b=0}},e.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(n,t){let r=new Function(O(n,t));return c(r)},e.wbg.__wbg_next_b34c09a202bf4424=function(){return W(function(n){let t=o(n).next();return c(t)},arguments)},e.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(n,t,r){Uint8Array.prototype.set.call($(n,t),o(r))},e.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(n){let t=o(n).queueMicrotask;return c(t)},e.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(n){queueMicrotask(o(n))},e.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(n){let t=Promise.resolve(o(n));return c(t)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(n,t,r){o(n)[d(t)]=d(r)},e.wbg.__wbg_set_7df433eea03a5c14=function(n,t,r){o(n)[t>>>0]=d(r)},e.wbg.__wbg_size_82fbdb656de23326=function(n){return o(n).size},e.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){let n=typeof global>"u"?null:global;return g(n)?0:c(n)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){let n=typeof globalThis>"u"?null:globalThis;return g(n)?0:c(n)},e.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){let n=typeof self>"u"?null:self;return g(n)?0:c(n)},e.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){let n=typeof window>"u"?null:window;return g(n)?0:c(n)},e.wbg.__wbg_storage_b04c3b736f10dd3b=function(n){let t=o(n).storage;return c(t)},e.wbg.__wbg_then_429f7caf1026411d=function(n,t,r){let i=o(n).then(o(t),o(r));return c(i)},e.wbg.__wbg_then_4f95312d68691235=function(n,t){let r=o(n).then(o(t));return c(r)},e.wbg.__wbg_value_57b7b035e117f7ee=function(n){let t=o(n).value;return c(t)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(n,t){let r=O(n,t);return c(r)},e.wbg.__wbindgen_cast_7cc765810adca37d=function(n,t){let r=C(n,t,s.__wasm_bindgen_func_elem_2763,v);return c(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(n){return c(n)},e.wbg.__wbindgen_object_clone_ref=function(n){let t=o(n);return c(t)},e.wbg.__wbindgen_object_drop_ref=function(n){d(n)},e}function V(e,n){return s=e.exports,k.__wbindgen_wasm_module=n,p=null,m=null,s}function te(e){if(s!==void 0)return s;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let n=T();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let t=new WebAssembly.Instance(e,n);return V(t,e)}async function k(e){if(s!==void 0)return s;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",import.meta.url));let n=T();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:t,module:r}=await ne(await e,n);return V(t,r)}var s,I,p,m,w,x,D,H,E,A,u,X,S,ee,R,P=q(()=>{"use strict";I=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>e.dtor(e.a,e.b));p=null;m=null;w=new Array(128).fill(void 0);w.push(void 0,null,!0,!1);x=w.length;D=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});D.decode();H=2146435072,E=0;A=new TextEncoder;"encodeInto"in A||(A.encodeInto=function(e,n){let t=A.encode(e);return n.set(t),{read:e.length,written:t.length}});u=0;X=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>s.__wbg_runoptions_free(e>>>0,1)),S=class{__destroy_into_raw(){let n=this.__wbg_ptr;return this.__wbg_ptr=0,X.unregister(this),n}free(){let n=this.__destroy_into_raw();s.__wbg_runoptions_free(n,0)}};Symbol.dispose&&(S.prototype[Symbol.dispose]=S.prototype.free);ee=new Set(["basic","cors","default"]);R=k});P();var j=null;async function F(){return j||(await(async()=>{try{await R();let e=await Promise.resolve().then(()=>(P(),U));j={run:e.run,toAst:e.toAst,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),j)}async function re(e,n,t={}){return await(await F()).run(e,n,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...t})}async function ie(e){return await(await F()).toAst(e)}async function oe(e){return await(await F()).format(e)}async function se(e){return await(await F()).diagnostics(e)}async function ce(e,n){return await(await F()).definedValues(e,n)}export{ce as definedValues,se as diagnostics,oe as format,re as run,ie as toAst};
1
+ var z=Object.defineProperty;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var q=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})};var U={};q(U,{ConversionOptions:()=>m,RunOptions:()=>F,default:()=>E,definedValues:()=>Q,diagnostics:()=>Z,format:()=>tt,htmlToMarkdown:()=>et,initSync:()=>_t,run:()=>nt,toAst:()=>rt});function s(e){A===d.length&&d.push(d.length+1);let t=A;return A=d[t],d[t]=e,t}function B(e,t){if(!(e instanceof t))throw new Error(`expected instance of ${t.name}`)}function W(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let o=e.description;return o==null?"Symbol":`Symbol(${o})`}if(t=="function"){let o=e.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(e)){let o=e.length,a="[";o>0&&(a+=W(e[0]));for(let c=1;c<o;c++)a+=", "+W(e[c]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
2
+ ${e.stack}`:r}function C(e){e<132||(d[e]=A,A=e)}function $(e,t){return e=e>>>0,x().subarray(e/1,e/1+t)}function p(){return(y===null||y.buffer.detached===!0||y.buffer.detached===void 0&&y.buffer!==_.memory.buffer)&&(y=new DataView(_.memory.buffer)),y}function M(e,t){return e=e>>>0,G(e,t)}function x(){return(h===null||h.byteLength===0)&&(h=new Uint8Array(_.memory.buffer)),h}function i(e){return d[e]}function T(e,t){try{return e.apply(this,t)}catch(n){_.__wbindgen_export3(s(n))}}function g(e){return e==null}function H(e,t,n,r){let o={a:e,b:t,cnt:1,dtor:n},a=(...c)=>{o.cnt++;let f=o.a;o.a=0;try{return r(f,o.b,...c)}finally{o.a=f,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--o.cnt===0&&(o.dtor(o.a,o.b),o.a=0,P.unregister(o))},P.register(a,o,o),a}function b(e,t,n){if(n===void 0){let f=S.encode(e),l=t(f.length,1)>>>0;return x().subarray(l,l+f.length).set(f),u=f.length,l}let r=e.length,o=t(r,1)>>>0,a=x(),c=0;for(;c<r;c++){let f=e.charCodeAt(c);if(f>127)break;a[o+c]=f}if(c!==r){c!==0&&(e=e.slice(c)),o=n(o,r,r=c+e.length*3,1)>>>0;let f=x().subarray(o+c,o+r),l=S.encodeInto(e,f);c+=l.written,o=n(o,r,c,1)>>>0}return u=c,o}function w(e){let t=i(e);return C(e),t}function G(e,t){return j+=t,j>=N&&(k=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),k.decode(),j=t),k.decode(x().subarray(e,e+t))}function X(e,t,n){_.__wasm_bindgen_func_elem_3018(e,t,s(n))}function Y(e,t,n,r){_.__wasm_bindgen_func_elem_816(e,t,s(n),s(r))}function Q(e,t){let n=b(e,_.__wbindgen_export,_.__wbindgen_export2),r=u;var o=g(t)?0:b(t,_.__wbindgen_export,_.__wbindgen_export2),a=u;let c=_.definedValues(n,r,o,a);return w(c)}function Z(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.diagnostics(t,n);return w(r)}function tt(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.format(t,n);return w(r)}function et(e,t){let n=b(e,_.__wbindgen_export,_.__wbindgen_export2),r=u,o=0;g(t)||(B(t,m),o=t.__destroy_into_raw());let a=_.htmlToMarkdown(n,r,o);return w(a)}function nt(e,t,n){let r=b(e,_.__wbindgen_export,_.__wbindgen_export2),o=u,a=b(t,_.__wbindgen_export,_.__wbindgen_export2),c=u,f=_.run(r,o,a,c,s(n));return w(f)}function rt(e){let t=b(e,_.__wbindgen_export,_.__wbindgen_export2),n=u,r=_.toAst(t,n);return w(r)}async function it(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(r){if(e.ok&&ot.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")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",r);else throw r}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function I(){let e={};return e.wbg={},e.wbg.__wbg_Error_52673b7de5a0ca89=function(t,n){let r=Error(M(t,n));return s(r)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(t,n){let r=String(i(n)),o=b(r,_.__wbindgen_export,_.__wbindgen_export2),a=u;p().setInt32(t+4,a,!0),p().setInt32(t+0,o,!0)},e.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b=function(t){let n=i(t),r=typeof n=="boolean"?n:void 0;return g(r)?16777215:r?1:0},e.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6=function(t,n){let r=W(i(n)),o=b(r,_.__wbindgen_export,_.__wbindgen_export2),a=u;p().setInt32(t+4,a,!0),p().setInt32(t+0,o,!0)},e.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317=function(t,n){return i(t)in i(n)},e.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd=function(t){return typeof i(t)=="function"},e.wbg.__wbg___wbindgen_is_object_ce774f3490692386=function(t){let n=i(t);return typeof n=="object"&&n!==null},e.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030=function(t){return typeof i(t)=="string"},e.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269=function(t){return i(t)===void 0},e.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d=function(t,n){return i(t)==i(n)},e.wbg.__wbg___wbindgen_number_get_9619185a74197f95=function(t,n){let r=i(n),o=typeof r=="number"?r:void 0;p().setFloat64(t+8,g(o)?0:o,!0),p().setInt32(t+0,!g(o),!0)},e.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42=function(t,n){let r=i(n),o=typeof r=="string"?r:void 0;var a=g(o)?0:b(o,_.__wbindgen_export,_.__wbindgen_export2),c=u;p().setInt32(t+4,c,!0),p().setInt32(t+0,a,!0)},e.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e=function(t,n){throw new Error(M(t,n))},e.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7=function(t){i(t)._wbg_cb_unref()},e.wbg.__wbg_arrayBuffer_3356d392ef2d2aa9=function(t){let n=i(t).arrayBuffer();return s(n)},e.wbg.__wbg_call_3020136f7a2d6e44=function(){return T(function(t,n,r){let o=i(t).call(i(n),i(r));return s(o)},arguments)},e.wbg.__wbg_call_abb4ff46ce38be40=function(){return T(function(t,n){let r=i(t).call(i(n));return s(r)},arguments)},e.wbg.__wbg_done_62ea16af4ce34b24=function(t){return i(t).done},e.wbg.__wbg_entries_7de5c9edd116e219=function(t){let n=i(t).entries();return s(n)},e.wbg.__wbg_entries_83c79938054e065f=function(t){let n=Object.entries(i(t));return s(n)},e.wbg.__wbg_from_29a8414a7a7cd19d=function(t){let n=Array.from(i(t));return s(n)},e.wbg.__wbg_getDirectory_9beed6c83b6861f5=function(t){let n=i(t).getDirectory();return s(n)},e.wbg.__wbg_getFile_3d12eaf635641f3a=function(t){let n=i(t).getFile();return s(n)},e.wbg.__wbg_get_6b7bd52aca3f9671=function(t,n){let r=i(t)[n>>>0];return s(r)},e.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe=function(t,n){let r=i(t)[i(n)];return s(r)},e.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355=function(t){let n;try{n=i(t)instanceof ArrayBuffer}catch{n=!1}return n},e.wbg.__wbg_instanceof_FileSystemDirectoryHandle_264085cadc86679a=function(t){let n;try{n=i(t)instanceof FileSystemDirectoryHandle}catch{n=!1}return n},e.wbg.__wbg_instanceof_FileSystemFileHandle_214d69e0ae063fc8=function(t){let n;try{n=i(t)instanceof FileSystemFileHandle}catch{n=!1}return n},e.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434=function(t){let n;try{n=i(t)instanceof Uint8Array}catch{n=!1}return n},e.wbg.__wbg_instanceof_Window_b5cf7783caa68180=function(t){let n;try{n=i(t)instanceof Window}catch{n=!1}return n},e.wbg.__wbg_length_22ac23eaec9d8053=function(t){return i(t).length},e.wbg.__wbg_length_d45040a40c570362=function(t){return i(t).length},e.wbg.__wbg_navigator_b49edef831236138=function(t){let n=i(t).navigator;return s(n)},e.wbg.__wbg_new_1ba21ce319a06297=function(){let t=new Object;return s(t)},e.wbg.__wbg_new_25f239778d6112b9=function(){let t=new Array;return s(t)},e.wbg.__wbg_new_6421f6084cc5bc5a=function(t){let n=new Uint8Array(i(t));return s(n)},e.wbg.__wbg_new_ff12d2b041fb48f1=function(t,n){try{var r={a:t,b:n},o=(c,f)=>{let l=r.a;r.a=0;try{return Y(l,r.b,c,f)}finally{r.a=l}};let a=new Promise(o);return s(a)}finally{r.a=r.b=0}},e.wbg.__wbg_new_no_args_cb138f77cf6151ee=function(t,n){let r=new Function(M(t,n));return s(r)},e.wbg.__wbg_next_b34c09a202bf4424=function(){return T(function(t){let n=i(t).next();return s(n)},arguments)},e.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd=function(t,n,r){Uint8Array.prototype.set.call($(t,n),i(r))},e.wbg.__wbg_queueMicrotask_9b549dfce8865860=function(t){let n=i(t).queueMicrotask;return s(n)},e.wbg.__wbg_queueMicrotask_fca69f5bfad613a5=function(t){queueMicrotask(i(t))},e.wbg.__wbg_resolve_fd5bfbaa4ce36e1e=function(t){let n=Promise.resolve(i(t));return s(n)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,n,r){i(t)[w(n)]=w(r)},e.wbg.__wbg_set_7df433eea03a5c14=function(t,n,r){i(t)[n>>>0]=w(r)},e.wbg.__wbg_size_82fbdb656de23326=function(t){return i(t).size},e.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335=function(){let t=typeof global>"u"?null:global;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1=function(){let t=typeof globalThis>"u"?null:globalThis;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_SELF_08f5a74c69739274=function(){let t=typeof self>"u"?null:self;return g(t)?0:s(t)},e.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024=function(){let t=typeof window>"u"?null:window;return g(t)?0:s(t)},e.wbg.__wbg_storage_b04c3b736f10dd3b=function(t){let n=i(t).storage;return s(n)},e.wbg.__wbg_then_429f7caf1026411d=function(t,n,r){let o=i(t).then(i(n),i(r));return s(o)},e.wbg.__wbg_then_4f95312d68691235=function(t,n){let r=i(t).then(i(n));return s(r)},e.wbg.__wbg_value_57b7b035e117f7ee=function(t){let n=i(t).value;return s(n)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(t,n){let r=M(t,n);return s(r)},e.wbg.__wbindgen_cast_29480d6a48b8e833=function(t,n){let r=H(t,n,_.__wasm_bindgen_func_elem_3017,X);return s(r)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(t){return s(t)},e.wbg.__wbindgen_object_clone_ref=function(t){let n=i(t);return s(n)},e.wbg.__wbindgen_object_drop_ref=function(t){w(t)},e}function V(e,t){return _=e.exports,v.__wbindgen_wasm_module=t,y=null,h=null,_}function _t(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=I();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let n=new WebAssembly.Instance(e,t);return V(n,e)}async function v(e){if(_!==void 0)return _;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("mq_wasm_bg.wasm",import.meta.url));let t=I();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await it(await e,t);return V(n,r)}var _,P,y,h,d,A,k,N,j,S,u,J,K,m,F,ot,E,R=L(()=>{"use strict";P=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>e.dtor(e.a,e.b));y=null;h=null;d=new Array(128).fill(void 0);d.push(void 0,null,!0,!1);A=d.length;k=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});k.decode();N=2146435072,j=0;S=new TextEncoder;"encodeInto"in S||(S.encodeInto=function(e,t){let n=S.encode(e);return t.set(n),{read:e.length,written:n.length}});u=0;J=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_conversionoptions_free(e>>>0,1)),K=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>_.__wbg_runoptions_free(e>>>0,1)),m=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,J.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_conversionoptions_free(t,0)}get extract_scripts_as_code_blocks(){return _.__wbg_get_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr)!==0}set extract_scripts_as_code_blocks(t){_.__wbg_set_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr,t)}get generate_front_matter(){return _.__wbg_get_conversionoptions_generate_front_matter(this.__wbg_ptr)!==0}set generate_front_matter(t){_.__wbg_set_conversionoptions_generate_front_matter(this.__wbg_ptr,t)}get use_title_as_h1(){return _.__wbg_get_conversionoptions_use_title_as_h1(this.__wbg_ptr)!==0}set use_title_as_h1(t){_.__wbg_set_conversionoptions_use_title_as_h1(this.__wbg_ptr,t)}};Symbol.dispose&&(m.prototype[Symbol.dispose]=m.prototype.free);F=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,K.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_runoptions_free(t,0)}};Symbol.dispose&&(F.prototype[Symbol.dispose]=F.prototype.free);ot=new Set(["basic","cors","default"]);E=v});R();var D=null;async function O(){return D||(await(async()=>{try{await E();let e=await Promise.resolve().then(()=>(R(),U));D={run:e.run,toAst:e.toAst,format:e.format,diagnostics:e.diagnostics,definedValues:e.definedValues,htmlToMarkdown:e.htmlToMarkdown}}catch(e){throw new Error(`Failed to initialize mq WebAssembly module: ${e}`)}})(),D)}async function st(e,t,n={}){return await(await O()).run(e,t,{isUpdate:!1,inputFormat:"markdown",listStyle:"dash",linkUrlStyle:"none",linkTitleStyle:"paren",...n})}async function ct(e){return await(await O()).toAst(e)}async function at(e){return await(await O()).format(e)}async function ft(e){return await(await O()).diagnostics(e)}async function ut(e,t){return await(await O()).definedValues(e,t)}export{ut as definedValues,ft as diagnostics,at as format,st as run,ct as toAst};
package/dist/mq_wasm.js CHANGED
@@ -9,6 +9,12 @@ function addHeapObject(obj) {
9
9
  return idx;
10
10
  }
11
11
 
12
+ function _assertClass(instance, klass) {
13
+ if (!(instance instanceof klass)) {
14
+ throw new Error(`expected instance of ${klass.name}`);
15
+ }
16
+ }
17
+
12
18
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
13
19
  ? { register: () => {}, unregister: () => {} }
14
20
  : new FinalizationRegistry(state => state.dtor(state.a, state.b));
@@ -229,18 +235,75 @@ if (!('encodeInto' in cachedTextEncoder)) {
229
235
 
230
236
  let WASM_VECTOR_LEN = 0;
231
237
 
232
- function __wasm_bindgen_func_elem_2764(arg0, arg1, arg2) {
233
- wasm.__wasm_bindgen_func_elem_2764(arg0, arg1, addHeapObject(arg2));
238
+ function __wasm_bindgen_func_elem_3018(arg0, arg1, arg2) {
239
+ wasm.__wasm_bindgen_func_elem_3018(arg0, arg1, addHeapObject(arg2));
234
240
  }
235
241
 
236
- function __wasm_bindgen_func_elem_718(arg0, arg1, arg2, arg3) {
237
- wasm.__wasm_bindgen_func_elem_718(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
242
+ function __wasm_bindgen_func_elem_816(arg0, arg1, arg2, arg3) {
243
+ wasm.__wasm_bindgen_func_elem_816(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
238
244
  }
239
245
 
246
+ const ConversionOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
247
+ ? { register: () => {}, unregister: () => {} }
248
+ : new FinalizationRegistry(ptr => wasm.__wbg_conversionoptions_free(ptr >>> 0, 1));
249
+
240
250
  const RunOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
241
251
  ? { register: () => {}, unregister: () => {} }
242
252
  : new FinalizationRegistry(ptr => wasm.__wbg_runoptions_free(ptr >>> 0, 1));
243
253
 
254
+ export class ConversionOptions {
255
+ __destroy_into_raw() {
256
+ const ptr = this.__wbg_ptr;
257
+ this.__wbg_ptr = 0;
258
+ ConversionOptionsFinalization.unregister(this);
259
+ return ptr;
260
+ }
261
+ free() {
262
+ const ptr = this.__destroy_into_raw();
263
+ wasm.__wbg_conversionoptions_free(ptr, 0);
264
+ }
265
+ /**
266
+ * @returns {boolean}
267
+ */
268
+ get extract_scripts_as_code_blocks() {
269
+ const ret = wasm.__wbg_get_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr);
270
+ return ret !== 0;
271
+ }
272
+ /**
273
+ * @param {boolean} arg0
274
+ */
275
+ set extract_scripts_as_code_blocks(arg0) {
276
+ wasm.__wbg_set_conversionoptions_extract_scripts_as_code_blocks(this.__wbg_ptr, arg0);
277
+ }
278
+ /**
279
+ * @returns {boolean}
280
+ */
281
+ get generate_front_matter() {
282
+ const ret = wasm.__wbg_get_conversionoptions_generate_front_matter(this.__wbg_ptr);
283
+ return ret !== 0;
284
+ }
285
+ /**
286
+ * @param {boolean} arg0
287
+ */
288
+ set generate_front_matter(arg0) {
289
+ wasm.__wbg_set_conversionoptions_generate_front_matter(this.__wbg_ptr, arg0);
290
+ }
291
+ /**
292
+ * @returns {boolean}
293
+ */
294
+ get use_title_as_h1() {
295
+ const ret = wasm.__wbg_get_conversionoptions_use_title_as_h1(this.__wbg_ptr);
296
+ return ret !== 0;
297
+ }
298
+ /**
299
+ * @param {boolean} arg0
300
+ */
301
+ set use_title_as_h1(arg0) {
302
+ wasm.__wbg_set_conversionoptions_use_title_as_h1(this.__wbg_ptr, arg0);
303
+ }
304
+ }
305
+ if (Symbol.dispose) ConversionOptions.prototype[Symbol.dispose] = ConversionOptions.prototype.free;
306
+
244
307
  export class RunOptions {
245
308
  __destroy_into_raw() {
246
309
  const ptr = this.__wbg_ptr;
@@ -291,6 +354,23 @@ export function format(code) {
291
354
  return takeObject(ret);
292
355
  }
293
356
 
357
+ /**
358
+ * @param {string} html_input
359
+ * @param {ConversionOptions | null} [options]
360
+ * @returns {Promise<string>}
361
+ */
362
+ export function htmlToMarkdown(html_input, options) {
363
+ const ptr0 = passStringToWasm0(html_input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
364
+ const len0 = WASM_VECTOR_LEN;
365
+ let ptr1 = 0;
366
+ if (!isLikeNone(options)) {
367
+ _assertClass(options, ConversionOptions);
368
+ ptr1 = options.__destroy_into_raw();
369
+ }
370
+ const ret = wasm.htmlToMarkdown(ptr0, len0, ptr1);
371
+ return takeObject(ret);
372
+ }
373
+
294
374
  /**
295
375
  * @param {string} code
296
376
  * @param {string} content
@@ -545,7 +625,7 @@ function __wbg_get_imports() {
545
625
  const a = state0.a;
546
626
  state0.a = 0;
547
627
  try {
548
- return __wasm_bindgen_func_elem_718(a, state0.b, arg0, arg1);
628
+ return __wasm_bindgen_func_elem_816(a, state0.b, arg0, arg1);
549
629
  } finally {
550
630
  state0.a = a;
551
631
  }
@@ -625,9 +705,9 @@ function __wbg_get_imports() {
625
705
  const ret = getStringFromWasm0(arg0, arg1);
626
706
  return addHeapObject(ret);
627
707
  };
628
- imports.wbg.__wbindgen_cast_7cc765810adca37d = function(arg0, arg1) {
629
- // Cast intrinsic for `Closure(Closure { dtor_idx: 261, function: Function { arguments: [Externref], shim_idx: 262, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
630
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_2763, __wasm_bindgen_func_elem_2764);
708
+ imports.wbg.__wbindgen_cast_29480d6a48b8e833 = function(arg0, arg1) {
709
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 286, function: Function { arguments: [Externref], shim_idx: 287, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
710
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3017, __wasm_bindgen_func_elem_3018);
631
711
  return addHeapObject(ret);
632
712
  };
633
713
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
Binary file
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "mq-web",
3
3
  "description": "A jq-like command-line tool for Markdown processing",
4
- "version": "0.5.4",
4
+ "version": "0.5.6",
5
5
  "author": "harehare",
6
6
  "license": "MIT",
7
7
  "bugs": {
8
8
  "url": "https://github.com/harehare/mq/issues"
9
9
  },
10
10
  "devDependencies": {
11
- "oxlint": "^1.0.0",
12
- "tsup": "^8.0.0",
13
- "typescript": "^5.0.0"
11
+ "oxlint": "^1.31.0",
12
+ "tsup": "^8.5.1",
13
+ "typescript": "^5.9.3"
14
14
  },
15
15
  "files": [
16
16
  "dist"