fix: markdown autolinking with images
This commit is contained in:
parent
46849ba66c
commit
c757ddb77a
3 changed files with 7 additions and 4 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -3353,7 +3353,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tetratto-shared"
|
name = "tetratto-shared"
|
||||||
version = "12.0.3"
|
version = "12.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ammonia",
|
"ammonia",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tetratto-shared"
|
name = "tetratto-shared"
|
||||||
description = "Shared stuff for Tetratto"
|
description = "Shared stuff for Tetratto"
|
||||||
version = "12.0.3"
|
version = "12.0.4"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
|
|
|
@ -173,13 +173,16 @@ pub fn parse_alignment(input: &str) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adapted from <https://git.cypr.io/oz/autolink-rust>.
|
/// Adapted from <https://git.cypr.io/oz/autolink-rust>.
|
||||||
|
///
|
||||||
|
/// 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 {
|
pub fn autolinks(input: &str) -> String {
|
||||||
if input.len() == 0 {
|
if input.len() == 0 {
|
||||||
return String::new();
|
return String::new();
|
||||||
}
|
}
|
||||||
|
|
||||||
let pattern = regex::Regex::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();
|
.unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue