From a340a676f7e63f969de33cfc2e43375e1c572c55 Mon Sep 17 00:00:00 2001 From: Vincent Huang Date: Tue, 23 Aug 2022 23:27:12 -0500 Subject: [PATCH] Fix wikilink processing bug --- util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util.go b/util.go index a908789..35c59ea 100644 --- a/util.go +++ b/util.go @@ -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", "/")