Sublists work now
This commit is contained in:
parent
8e860b89e7
commit
b72d43b250
16
src/main.rs
16
src/main.rs
@ -60,16 +60,20 @@ fn parse_markdown(page_content: String) -> (String, Vec<String>) {
|
||||
// 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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user