diff --git a/Cargo.lock b/Cargo.lock index 1631ec4..e389280 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3353,7 +3353,7 @@ dependencies = [ [[package]] name = "tetratto-shared" -version = "12.0.3" +version = "12.0.4" dependencies = [ "ammonia", "chrono", diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index 13250e4..158c99b 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tetratto-shared" description = "Shared stuff for Tetratto" -version = "12.0.3" +version = "12.0.4" edition = "2024" authors.workspace = true repository.workspace = true diff --git a/crates/shared/src/markdown.rs b/crates/shared/src/markdown.rs index 6e4cb04..d0a9c56 100644 --- a/crates/shared/src/markdown.rs +++ b/crates/shared/src/markdown.rs @@ -173,17 +173,20 @@ pub fn parse_alignment(input: &str) -> String { } /// Adapted from . +/// +/// The only real change here is that autolinks require a whitespace OR end the +/// end of the pattern to match here. pub fn autolinks(input: &str) -> String { if input.len() == 0 { return String::new(); } let pattern = regex::Regex::new( - r"(?ix)\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))", + r"(?ix)\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))(\s|$)", ) .unwrap(); pattern - .replace_all(input, "$0") + .replace_all(input, "$0 ") .to_string() }