From b577500a54f76449887f9a10b65bf90c41a8a29e Mon Sep 17 00:00:00 2001 From: Moritz <13287984+mohe2015@users.noreply.github.com> Date: Fri, 17 Jan 2020 17:49:50 +0100 Subject: [PATCH] Fix markdown anchor links (#9673) (#9840) --- 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