exclude external links: update list (fix #91)

This commit is contained in:
Mylloon 2024-12-13 15:47:21 +01:00
parent ef40ea96d7
commit 7752363039
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -68,7 +68,37 @@ pub fn get_options(path: Option<FilePath>, metadata_type: MType) -> ComrakOption
.underline(true) .underline(true)
.maybe_link_url_rewriter(match metadata_type { .maybe_link_url_rewriter(match metadata_type {
MType::Cours => Some(Arc::new(move |url: &str| { MType::Cours => Some(Arc::new(move |url: &str| {
if url.contains("://") { // Exclude external links
if [
"://",
"mailto:",
"magnet:",
"ftp:",
"tel:",
"irc:",
"geo:",
"ftps:",
"im:",
"ircs:",
"bitcoin:",
"matrix:",
"mms:",
"news:",
"nntp:",
"openpgp4fpr:",
"sftp:",
"sip:",
"sms:",
"smsto:",
"ssh:",
"urn:",
"webcal:",
"wtai:",
"xmpp:",
]
.iter()
.any(|&item| url.contains(item))
{
return String::from(url); return String::from(url);
} }