Fix wikilink processing bug

This commit is contained in:
Vincent Huang 2022-08-23 23:27:12 -05:00 committed by GitHub
parent afb663e3ad
commit a340a676f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,9 +23,9 @@ func processTarget(source string) string {
if strings.HasPrefix(source, "/") {
return strings.TrimSuffix(source, ".md")
}
res := "/" + strings.TrimSuffix(strings.TrimSuffix(source, ".html"), ".md")
res := strings.Split(source, "#")[0]
res = "/" + strings.TrimSuffix(strings.TrimSuffix(res, ".html"), ".md")
res, _ = url.PathUnescape(res)
res = strings.Split(res, "#")[0]
res = strings.TrimSpace(res)
res = UnicodeSanitize(res)
return strings.ReplaceAll(url.PathEscape(res), "%2F", "/")