From 71769d85e64fe5b4d50bc640dab814147fcfd193 Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 6 Jul 2024 13:09:02 -0400 Subject: [PATCH] update --- client/src/components/markdown.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/client/src/components/markdown.rs b/client/src/components/markdown.rs index 8a66ab9..996bbc2 100644 --- a/client/src/components/markdown.rs +++ b/client/src/components/markdown.rs @@ -11,7 +11,6 @@ pub fn markdown(props: &Props) -> Html { let link_regex = Regex::new(r"\[([^\]]+)\]\((https?://[^\)]+)\)").unwrap(); let html = props.content.lines().map(|line| { - // Process links for the entire line let mut line_html = vec![]; let mut last_pos = 0; for chars in link_regex.captures_iter(line) { @@ -35,18 +34,18 @@ pub fn markdown(props: &Props) -> Html { let combined_html = html! { <>{for line_html} }; match line { - l if l.starts_with("# ") => html! {

{&l[1..]}

}, - l if l.starts_with("## ") => html! {

{&l[2..]}

}, - l if l.starts_with("### ") => html! {

{&l[3..]}

}, - l if l.starts_with("#### ") => html! {

{&l[4..]}

}, + l if l.starts_with("# ") => html! {

{&l[2..]}

}, + l if l.starts_with("## ") => html! {

{&l[3..]}

}, + l if l.starts_with("### ") => html! {

{&l[4..]}

}, + l if l.starts_with("#### ") => html! {

{&l[5..]}

}, l if l.starts_with("```") => { html! {

{line.replace("```", "")}

} } l if l.starts_with("---") => html! {
}, l if l.starts_with("___") => html! {
}, - l if l.is_empty() => html! {
}, l if l.starts_with("-") => html! {
  • {combined_html}
  • }, - _ => html! {

    {line}

    }, + l if l.is_empty() => html! {
    }, + _ => html! {

    {combined_html}

    }, } });