Add special character encoding to external links

This commit is contained in:
Christoph Hagen 2023-02-22 11:46:50 +01:00
parent 6e717a8cf7
commit 5f5c250272

View File

@ -278,7 +278,10 @@ struct PageContentGenerator {
results.warning("Invalid external link definition", source: page.path)
return nil
}
let url = parts[0].trimmed
guard let url = parts[0].trimmed.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
results.warning("Invalid external link \(parts[0].trimmed)", source: page.path)
return nil
}
let title = parts[1].trimmed
return (url, title)