diff --git a/src/convert.rs b/src/convert.rs index 2e81fd2..93df3e2 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -64,6 +64,7 @@ fn convert_line(source: &str) -> String { let mut is_b = false; let mut is_code = false; let mut is_ul = false; + let mut is_html_tag = false; let toggle = |state: bool, tag: &str| { if state { format!("<{tag}>") @@ -76,6 +77,13 @@ fn convert_line(source: &str) -> String { let mut chars = source.chars().peekable(); while let Some(c) = chars.next() { + if is_html_tag { + out.push(c); + if c == '>' { + is_html_tag = false; + } + continue; + } if let Some(link_c) = &mut link { match link_c { (link_text, None) => { @@ -119,6 +127,9 @@ fn convert_line(source: &str) -> String { } else if c == '_' { is_ul = !is_ul; out += &toggle(is_ul, "u"); + } else if c == '<' { + out.push(c); + is_html_tag = true; } else { out.push(c); }