1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-09-02 02:48:05 +00:00

Handle anchored links correctly

This commit is contained in:
bouncepaw
2021-03-14 20:10:08 +05:00
parent f3c4a45c3d
commit 140d97ddf4
2 changed files with 6 additions and 1 deletions

View File

@@ -97,6 +97,11 @@ func From(address, display, hyphaName string) *Link {
link.Display = strings.TrimSpace(display)
}
if pos := strings.IndexRune(address, '#'); pos != -1 {
link.Anchor = address[pos:]
address = address[:pos]
}
switch {
case strings.ContainsRune(address, ':'):
pos := strings.IndexRune(address, ':')