Skip to content

Commit

Permalink
Merge pull request #113 from rodneylab/build__add_node_build
Browse files Browse the repository at this point in the history
build: 🧱 add Node build
  • Loading branch information
rodneylab authored Nov 29, 2024
2 parents d8e0dc4 + 3dbae84 commit a44e7f3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"tasks": {
"check": "deno fmt --check && deno lint && deno check **/*.ts",
"test": "deno test -A",
"wasmbuild": "deno run -A jsr:@deno/[email protected] --project=parsedown"
"wasmbuild:deno": "deno run -A jsr:@deno/[email protected] --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" }
}
Binary file modified lib/parsedown_bg.wasm
Binary file not shown.
6 changes: 3 additions & 3 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type MarkdownToPlaintextOptions = Omit<MarkdownToHtmlOptions, "searchTerm">;

/**
* 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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/html_process/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<Attribute>, flags: ElementFlags) -> Handle {
Expand Down
3 changes: 2 additions & 1 deletion src/html_process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -152,6 +152,7 @@ impl<'a> Builder<'a> {
self.process_dom(dom)
}

#[expect(clippy::ref_option)]
fn adjust_node_attributes(
&self,
child: &mut Handle,
Expand Down
2 changes: 1 addition & 1 deletion src/markdown/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a44e7f3

Please sign in to comment.