don't format inline html tags

This commit is contained in:
Crispy 2024-05-31 18:38:16 +02:00
parent 0df6daa906
commit 5b4a9c3e2d

View file

@ -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);
}