Fix embedded image links shown as not found (#127)

pull/140/head
Mickaël Menu 2 years ago committed by GitHub
parent f8ef8cc093
commit eddc4b5845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,7 +2,12 @@
All notable changes to this project will be documented in this file.
<!-- ## Unreleased -->
## Unreleased
### Fixed
* [#126](https://github.com/mickael-menu/zk/issues/126) Embedded image links shown as not found.
## 0.9.0

@ -218,6 +218,11 @@ func (d *document) DocumentLinks() ([]documentLink, error) {
}
for _, match := range markdownLinkRegex.FindAllStringSubmatchIndex(line, -1) {
// Ignore embedded image, e.g. ![title](href.png)
if match[0] > 0 && line[match[0]-1] == '!' {
continue
}
href := line[match[4]:match[5]]
// Valid Markdown links are percent-encoded.
if decodedHref, err := url.PathUnescape(href); err == nil {

Loading…
Cancel
Save