Skip to content

Commit 6291c64

Browse files
committed
fix: markdown node handler
1 parent f041ae2 commit 6291c64

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

karaty/src/components/markdown.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub fn MdastNode(cx: Scope, nodes: Vec<Node>) -> Element {
135135
language: language.clone().unwrap_or_default(),
136136
}
137137
}
138-
} else if let Node::BlockQuote(_) = node {
138+
} else if let Node::Blockquote(_) = node {
139139
rsx! {
140140
blockquote {
141141
embedded
@@ -153,7 +153,7 @@ pub fn MdastNode(cx: Scope, nodes: Vec<Node>) -> Element {
153153
}
154154
}
155155
} else if let Node::List(list) = node {
156-
let ordered = list.ordered.clone();
156+
let ordered = list.ordered;
157157
if ordered {
158158
rsx! {
159159
ol {
@@ -242,7 +242,7 @@ pub fn Text(cx: Scope, value: String) -> Element {
242242
while let Some(v) = re.exec(value) {
243243
let last_index = re.last_index() as usize;
244244
let arr = v.to_vec();
245-
let full = arr.get(0).unwrap();
245+
let full = arr.first().unwrap();
246246
let icon = arr.get(1).unwrap();
247247
let start_index = last_index - full.as_string().unwrap().len();
248248
contents.push(TextFlag::Text(

karaty/src/main.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(non_snake_case)]
2+
#![allow(elided_named_lifetimes)]
23

34
use std::collections::HashMap;
45

@@ -32,7 +33,7 @@ fn main() {
3233
fn App(cx: Scope) -> Element {
3334
// init karaty root app
3435
let setup_config: &UseFuture<anyhow::Result<GlobalData, anyhow::Error>> =
35-
use_future(&cx, (), |_| async move {
36+
use_future(cx, (), |_| async move {
3637
let config = setup_config().await?;
3738
let mut routing = config.routing.clone();
3839

@@ -63,7 +64,7 @@ fn App(cx: Scope) -> Element {
6364
cx.render(rsx! {
6465
// dioxus toast manager init
6566
ToastFrame {
66-
manager: fermi::use_atom_ref(&cx, &TOAST_MANAGER),
67+
manager: fermi::use_atom_ref(cx, &TOAST_MANAGER),
6768
}
6869
// dioxus router info
6970
Router {
@@ -133,21 +134,17 @@ fn App(cx: Scope) -> Element {
133134
}
134135
})
135136
}
136-
Some(Err(e)) => {
137-
return cx.render(rsx! {
138-
div {
139-
class: "h-screen flex justify-center items-center",
140-
p {
141-
class: "text-gray-400 text-xl font-semibold",
142-
"{e}"
143-
}
137+
Some(Err(e)) => cx.render(rsx! {
138+
div {
139+
class: "h-screen flex justify-center items-center",
140+
p {
141+
class: "text-gray-400 text-xl font-semibold",
142+
"{e}"
144143
}
145-
});
146-
}
147-
None => {
148-
return cx.render(rsx! {
149-
Loading {}
150-
});
151-
}
144+
}
145+
}),
146+
None => cx.render(rsx! {
147+
Loading {}
148+
}),
152149
}
153150
}

0 commit comments

Comments
 (0)