Merge pull request #28 from vincenthuang75025/master

This commit is contained in:
Jacky Zhao 2022-08-28 01:08:05 -04:00 committed by GitHub
commit 34bb5aac83
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, "/") { if strings.HasPrefix(source, "/") {
return strings.TrimSuffix(source, ".md") 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, _ = url.PathUnescape(res)
res = strings.Split(res, "#")[0]
res = strings.TrimSpace(res) res = strings.TrimSpace(res)
res = UnicodeSanitize(res) res = UnicodeSanitize(res)
return strings.ReplaceAll(url.PathEscape(res), "%2F", "/") return strings.ReplaceAll(url.PathEscape(res), "%2F", "/")