diff --git a/deno.json b/deno.json index 8df41ad..eaefcb0 100644 --- a/deno.json +++ b/deno.json @@ -9,7 +9,9 @@ "tasks": { "check": "deno fmt --check && deno lint && deno check **/*.ts", "test": "deno test -A", - "wasmbuild": "deno run -A jsr:@deno/wasmbuild@0.17.3 --project=parsedown" + "wasmbuild:deno": "deno run -A jsr:@deno/wasmbuild@0.17.3 --project=parsedown", + "wasmbuild:node": "wasm-pack build --target nodejs --scope rodneylab", + "wasmbuild": "deno task wasmbuild:deno && deno task wasmbuild:node" }, "imports": { "@std/assert": "jsr:@std/assert@^1.0.8" } } diff --git a/lib/parsedown_bg.wasm b/lib/parsedown_bg.wasm index 5afe2a0..af83c0b 100644 Binary files a/lib/parsedown_bg.wasm and b/lib/parsedown_bg.wasm differ diff --git a/mod.ts b/mod.ts index c4eae7d..0985859 100644 --- a/mod.ts +++ b/mod.ts @@ -32,7 +32,7 @@ type MarkdownToPlaintextOptions = Omit; /** * Convert the, input, `markdown` string to HTML using a [CommonMark](https://commonmark.org/) - * Markdown Parser + * Markdown Parser. * * @param markdown The Markdown text to parse * @param options.enableSmartPunctuation `true` if "something" should be replaced with @@ -63,7 +63,7 @@ const markdownToHtml: ( /** * Convert the, input, `markdown` string to plaintext, to use, for example in a broadcast email or - * RSS feed + * RSS feed. * * @param markdown The Markdown text to parse * @returns `markdown` parsed into a plaintext string @@ -85,7 +85,7 @@ const markdownToPlaintext: ( }; /** - * Convert the, input, `mjml` string to HTML, for use in a broadcast email, for example + * Convert the, input, `mjml` string to HTML, for use in a broadcast email, for example. * * @param markdown The Markdown text to parse * @returns `markdown` parsed into a plaintext string diff --git a/src/html_process/dom.rs b/src/html_process/dom.rs index 63387cc..699d3dc 100644 --- a/src/html_process/dom.rs +++ b/src/html_process/dom.rs @@ -162,7 +162,10 @@ impl TreeSink for RcDom { type Handle = Handle; - type ElemName<'a>=ExpandedName<'a> where Self: 'a; + type ElemName<'a> + = ExpandedName<'a> + where + Self: 'a; fn parse_error(&self, msg: Cow<'static, str>) { self.errors.borrow_mut().push(msg); @@ -197,10 +200,10 @@ impl TreeSink for RcDom { } fn elem_name<'a>(&self, target: &'a Handle) -> ExpandedName<'a> { - return match target.data { + match target.data { NodeData::Element { ref name, .. } => name.expanded(), _ => panic!("not an element"), - }; + } } fn create_element(&self, name: QualName, attrs: Vec, flags: ElementFlags) -> Handle { diff --git a/src/html_process/mod.rs b/src/html_process/mod.rs index 1dd4b99..66a0527 100644 --- a/src/html_process/mod.rs +++ b/src/html_process/mod.rs @@ -55,7 +55,7 @@ pub struct Builder<'a> { search_term: Option<&'a str>, } -impl<'a> Default for Builder<'a> { +impl Default for Builder<'_> { fn default() -> Self { Builder { canonical_root_url: None, @@ -152,6 +152,7 @@ impl<'a> Builder<'a> { self.process_dom(dom) } + #[expect(clippy::ref_option)] fn adjust_node_attributes( &self, child: &mut Handle, diff --git a/src/markdown/mod.rs b/src/markdown/mod.rs index 8729528..1cff633 100644 --- a/src/markdown/mod.rs +++ b/src/markdown/mod.rs @@ -361,7 +361,7 @@ pub struct ParseMarkdownOptions<'a> { enable_smart_punctuation: bool, } -impl<'a> Default for ParseMarkdownOptions<'a> { +impl Default for ParseMarkdownOptions<'_> { fn default() -> Self { ParseMarkdownOptions { canonical_root_url: None,