diff --git a/src/main.rs b/src/main.rs index 836020c..7c682c4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,16 +60,20 @@ fn parse_markdown(page_content: String) -> (String, Vec) { // Block quotes let block_quotes_regex = Regex::new(r"^>(.*)").unwrap(); parsed_line = block_quotes_regex.replace_all(&parsed_line, |caps: ®ex::Captures| { - format!(" | {}", &caps[1].on_black()) + format!(" | {}", &caps[1]) }).to_string(); // Ordered list - let ordered_list_regex = Regex::new(r"^([0-9]+)\.(.*)").unwrap(); - parsed_line = ordered_list_regex.replace_all(&parsed_line, " $1. $2").to_string(); + let ordered_list_regex = Regex::new(r"^([ \t]+|^)([0-9]+)\. (.*)").unwrap(); + parsed_line = ordered_list_regex.replace_all(&parsed_line, |caps: ®ex::Captures| { + format!("{} {}. {}", &caps[1], &caps[2], &caps[3]) + }).to_string(); - // Unordered list - let unordered_list_regex = Regex::new(r"^(-|\+|\*).(.*)").unwrap(); - parsed_line = unordered_list_regex.replace_all(&parsed_line, " • $2").to_string(); + // Unordered list ([ ]+|^)- (.*) + let unordered_list_regex = Regex::new(r"^([ \t]+|^)(-|\+|\*).(.*)").unwrap(); + parsed_line = unordered_list_regex.replace_all(&parsed_line, |caps: ®ex::Captures| { + format!("{} • {}", &caps[1], &caps[3]) + }).to_string(); // Inline code let inline_code_regex = Regex::new(r"`(.*?)`").unwrap();