From f740943df4fab9c50eb44261569eb4366447c93e Mon Sep 17 00:00:00 2001 From: Moritz <13287984+mohe2015@users.noreply.github.com> Date: Thu, 16 Jan 2020 12:23:48 +0100 Subject: [PATCH] Fix markdown anchor links (#9673) Co-authored-by: Lauris BH --- modules/markup/markdown/goldmark.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index 2a2a9dce6..a1c8e1ded 100644 --- a/modules/markup/markdown/goldmark.go +++ b/modules/markup/markdown/goldmark.go @@ -79,6 +79,9 @@ func (g *GiteaASTTransformer) Transform(node *ast.Document, reader text.Reader, } link = []byte(giteautil.URLJoin(pc.Get(urlPrefixKey).(string), lnk)) } + if len(link) > 0 && link[0] == '#' { + link = []byte("#user-content-" + string(link)[1:]) + } v.Destination = link } return ast.WalkContinue, nil