diff --git a/src/database/entities/microservice/january.rs b/src/database/entities/microservice/january.rs index 39df9ef0..97ffaf62 100644 --- a/src/database/entities/microservice/january.rs +++ b/src/database/entities/microservice/january.rs @@ -100,11 +100,15 @@ impl Embed { pub async fn generate(content: String) -> Result> { lazy_static! { static ref RE_CODE: Regex = Regex::new("```(?:.|\n)+?```|`(?:.|\n)+?`").unwrap(); + static ref RE_IGNORED: Regex = Regex::new("()").unwrap(); } // Ignore code blocks. let content = RE_CODE.replace_all(&content, ""); + // Ignore all content between angle brackets starting with http. + let content = RE_IGNORED.replace_all(&content, ""); + let content = content // Ignore quoted lines. .split("\n") @@ -121,7 +125,6 @@ impl Embed { .join("\n"); // ! FIXME: allow multiple links - // ! FIXME: prevent generation if link is surrounded with < > let mut finder = LinkFinder::new(); finder.kinds(&[LinkKind::Url]); let links: Vec<_> = finder.links(&content).collect();