diff --git a/Cargo.lock b/Cargo.lock index b3343cb..aff16da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1556,7 +1556,7 @@ dependencies = [ [[package]] name = "rust-web-markdown" version = "0.1.0" -source = "git+https://github.com/rambip/rust-web-markdown/#864ba81fb8e3aa00188fe9cc7f44b145fbeecc66" +source = "git+https://github.com/rambip/rust-web-markdown/#0629ab179f1d376fa8f6e6086ae8d7219f987885" dependencies = [ "katex", "lazy_static", diff --git a/src/lib.rs b/src/lib.rs index fc47512..e43234c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,7 +24,7 @@ pub mod debug { pub struct EventInfo(pub WriteSignal>); } -impl Context<'static> for __MdProps { +impl<'a> Context<'a, 'static> for &'a __MdProps { type View = View; type HtmlCallback = Callback>; @@ -33,7 +33,7 @@ impl Context<'static> for __MdProps { type Setter = WriteSignal; - fn props<'a>(&'a self) -> rust_web_markdown::MarkdownProps<'a, 'static, Self> { + fn props(self) -> rust_web_markdown::MarkdownProps<'a, 'static, Self> { rust_web_markdown::MarkdownProps { components: &self.components, frontmatter: self.frontmatter.as_ref(), @@ -46,12 +46,12 @@ impl Context<'static> for __MdProps { } } - fn set(&self, setter: &WriteSignal, value: T) { + fn set(self, setter: &WriteSignal, value: T) { setter.set(value) } #[cfg(feature="debug")] - fn send_debug_info(&self, info: Vec) { + fn send_debug_info(self, info: Vec) { let set_event_info = use_context::(); if let Some(setter) = set_event_info { @@ -60,11 +60,11 @@ impl Context<'static> for __MdProps { } #[cfg(not(feature="debug"))] - fn send_debug_info(&self, _info: Vec) { + fn send_debug_info(self, _info: Vec) { } fn el_with_attributes( - &self, + self, e: HtmlElement, inside: Self::View, attributes: ElementAttributes>, @@ -109,7 +109,7 @@ impl Context<'static> for __MdProps { r.into_view() } - fn el_hr(&self, attributes: ElementAttributes>) -> Self::View { + fn el_hr(self, attributes: ElementAttributes>) -> Self::View { let mut r = html::hr(); if let Some(s) = attributes.style { @@ -125,27 +125,27 @@ impl Context<'static> for __MdProps { r.into_view() } - fn el_br(&self) -> Self::View { + fn el_br(self) -> Self::View { view! {
}.into_view() } - fn el_fragment(&self, children: Vec) -> Self::View { + fn el_fragment(self, children: Vec) -> Self::View { children.into_iter().collect() } - fn el_a(&self, children: Self::View, href: &str) -> Self::View { + fn el_a(self, children: Self::View, href: &str) -> Self::View { view! {{children}}.into_view() } - fn el_img(&self, src: &str, alt: &str) -> Self::View { + fn el_img(self, src: &str, alt: &str) -> Self::View { view! {{alt.to_string()}/}.into_view() } - fn el_text(&self, text: &str) -> Self::View { + fn el_text(self, text: &str) -> Self::View { text.to_string().into_view() } - fn mount_dynamic_link(&self, rel: &str, href: &str, integrity: &str, crossorigin: &str) { + fn mount_dynamic_link(self, rel: &str, href: &str, integrity: &str, crossorigin: &str) { let document = document(); let link = document.create_element("link").unwrap(); @@ -160,7 +160,7 @@ impl Context<'static> for __MdProps { .append_child(&link).unwrap(); } - fn el_input_checkbox(&self, checked: bool, attributes: ElementAttributes>) -> Self::View { + fn el_input_checkbox(self, checked: bool, attributes: ElementAttributes>) -> Self::View { let mut r = html::input() .attr("type", "checkbox") .attr("checked", checked) @@ -187,7 +187,7 @@ impl Context<'static> for __MdProps { } fn make_handler( - &self, + self, f: F, ) -> Self::Handler { Callback::new(f)