From e4b08b45bcb8796c9a33905f4052a57be4bd62b2 Mon Sep 17 00:00:00 2001 From: deadvey Date: Tue, 21 Jan 2025 23:59:18 +0000 Subject: [PATCH] ``` --- Cargo.toml | 1 + src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2fe87a2..375a53a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,4 @@ regex = "1.11.1" url = "2.5.4" termion = "4.0.3" open = "5.3.2" +url = "2.5.4" diff --git a/src/main.rs b/src/main.rs index 524bd5e..9985253 100644 --- a/src/main.rs +++ b/src/main.rs @@ -83,7 +83,7 @@ fn parse_markdown(page_content: String) -> (String, Vec) { }).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: ®ex::Captures| { format!("{}", &caps[1].magenta()) }).to_string(); @@ -120,7 +120,7 @@ fn parse_markdown(page_content: String) -> (String, Vec) { } // 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: ®ex::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 { 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)