This commit is contained in:
deadvey 2025-01-21 23:59:18 +00:00
parent 1b8614b956
commit e4b08b45bc
2 changed files with 4 additions and 3 deletions

View File

@ -9,3 +9,4 @@ regex = "1.11.1"
url = "2.5.4"
termion = "4.0.3"
open = "5.3.2"
url = "2.5.4"

View File

@ -83,7 +83,7 @@ fn parse_markdown(page_content: String) -> (String, Vec<String>) {
}).to_string();
// Inline code
let inline_code_regex = Regex::new(r"`(.*?)`").unwrap();
let inline_code_regex = Regex::new(r"`([^`]+?)`").unwrap();
parsed_line = inline_code_regex.replace_all(&parsed_line, |caps: &regex::Captures| {
format!("{}", &caps[1].magenta())
}).to_string();
@ -120,7 +120,7 @@ fn parse_markdown(page_content: String) -> (String, Vec<String>) {
}
// multiline code
let multiline_code_regex = Regex::new(r"(?ms)%%%((.*?\n)+?)%%%").unwrap();
let multiline_code_regex = Regex::new(r"(?ms)```((.*?\n)+?)```").unwrap();
parsed_page_content = multiline_code_regex.replace_all(&parsed_page_content, |caps: &regex::Captures| {
// Capture the code inside the %% blocks
let code_block = &caps[1];
@ -218,7 +218,7 @@ fn parse_url(user_input: String, previous_host: &String) -> Result<Url, u8> {
if let Some(caps) = mttp_regex.captures(&user_input) {
url.hostname = caps[1].to_string();
url.port = 3477;
url.port = 3477;
url.path = caps[2].to_string();
url.protocol = "mttp".to_string();
Ok(url)