diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 2a476e9..7f4cd9a 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0 with: - version: 8 + version: 9 - name: Install Node dependencies run: pnpm install - name: Check Format diff --git a/Cargo.lock b/Cargo.lock index 73c3b6b..abfe390 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -290,9 +290,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown", @@ -324,9 +324,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.167" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "litemap" @@ -457,7 +457,7 @@ dependencies = [ "serde", "serde-wasm-bindgen", "textwrap", - "thiserror 2.0.3", + "thiserror 2.0.6", "url", "wasm-bindgen", ] @@ -618,9 +618,9 @@ dependencies = [ [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "ryu" @@ -782,11 +782,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.3" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl 2.0.6", ] [[package]] @@ -802,9 +802,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.3" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 7764578..dd92a08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,6 @@ pulldown-cmark-escape = "0.11.0" serde = { version = "1.0.215", features = ["derive"] } serde-wasm-bindgen = "0.6.5" textwrap = "0.16.1" -thiserror = "2.0.3" +thiserror = "2.0.6" url = "2.5.4" wasm-bindgen = { version = "=0.2.92", features = ["serde-serialize"] } diff --git a/lib/parsedown.generated.js b/lib/parsedown.generated.js index 7300fb4..f2746aa 100644 --- a/lib/parsedown.generated.js +++ b/lib/parsedown.generated.js @@ -4,7 +4,7 @@ // deno-fmt-ignore-file /// -// source-hash: 5e420860f9476779457dcdd2d889abf9802f2938 +// source-hash: f28def7121bbab3494416ee9b34fe483428d17ad let wasm; const heap = new Array(128).fill(undefined); @@ -50,18 +50,6 @@ function addHeapObject(obj) { return idx; } -function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - let WASM_VECTOR_LEN = 0; const cachedTextEncoder = typeof TextEncoder !== "undefined" @@ -127,6 +115,18 @@ function getInt32Memory0() { return cachedInt32Memory0; } +function dropObject(idx) { + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + let cachedFloat64Memory0 = null; function getFloat64Memory0() { @@ -319,9 +319,6 @@ const imports = { const ret = getStringFromWasm0(arg0, arg1); return addHeapObject(ret); }, - __wbindgen_object_drop_ref: function (arg0) { - takeObject(arg0); - }, __wbindgen_number_new: function (arg0) { const ret = arg0; return addHeapObject(ret); @@ -362,6 +359,9 @@ const imports = { __wbg_set_a47bac70306a19a7: function (arg0, arg1, arg2) { getObject(arg0).set(getObject(arg1), arg2 >>> 0); }, + __wbindgen_object_drop_ref: function (arg0) { + takeObject(arg0); + }, __wbindgen_error_new: function (arg0, arg1) { const ret = new Error(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); diff --git a/lib/parsedown_bg.wasm b/lib/parsedown_bg.wasm index 9127a78..5607bf0 100644 Binary files a/lib/parsedown_bg.wasm and b/lib/parsedown_bg.wasm differ diff --git a/mod.ts b/mod.ts index 0985859..3d513aa 100644 --- a/mod.ts +++ b/mod.ts @@ -35,9 +35,19 @@ type MarkdownToPlaintextOptions = Omit; * Markdown Parser. * * @param markdown The Markdown text to parse - * @param options.enableSmartPunctuation `true` if "something" should be replaced with - * “something”, etc. - * @returns `markdown` parsed into HTML as an object or an error object. If successful, the HTML is + * @param {Object} [options={}] - Parse options + * @param {boolean} options.enableSmartPunctuation - `true` if "something" should be replaced with + * “something”, etc. + * @param {string} options.canonicalRootUrl - if included, relative url gain this value as a prefix + * (`/home` becomes `https://example.com/home`) + * @param {string} options.searchTerm - if included, output HTML wraps any instances of this value + * in `mark` tags (`A senctence with the-search-term` becomes + * `A sentence with the-search-term`), for use in + * highlighting search results, with CSS, for example. The + * first instance also has `id=search-match` added the mark + * tag. You might use this to scroll the first match into view + * automatically. + * @returns {Object} `markdown` parsed into HTML as an object or an error object. If successful, the HTML is * in the `.html` field of the returned object. */ const markdownToHtml: (