diff --git a/Sources/Generator/Generators/PageContentGenerator.swift b/Sources/Generator/Generators/PageContentGenerator.swift index 957eaf8..aea5ef2 100644 --- a/Sources/Generator/Generators/PageContentGenerator.swift +++ b/Sources/Generator/Generators/PageContentGenerator.swift @@ -87,8 +87,11 @@ struct PageContentGenerator { // For a simple boxes: ![box](title;body) // A fancy page link: ![page](page_id) // External pages: ![external](url1, text1; url2, text2, ...) - let fileAndTitle = markdown.between(first: "](", andLast: ")") - let alt = markdown.between("[", and: "]").nonEmpty + guard let fileAndTitle = markdown.between(first: "](", andLast: ")").removingPercentEncoding else { + results.warning("Invalid percent encoding for markdown image", source: page.path) + return "" + } + let alt = markdown.between("[", and: "]").nonEmpty?.removingPercentEncoding if let alt = alt, let command = ShorthandMarkdownKey(rawValue: alt) { return handleShortHandCommand(command, page: page, language: language, content: fileAndTitle) }