diff options
author | Moritz <13287984+mohe2015@users.noreply.github.com> | 2020-01-16 12:23:48 +0100 |
---|---|---|
committer | Antoine GIRARD <sapk@users.noreply.github.com> | 2020-01-16 12:23:48 +0100 |
commit | f740943df4fab9c50eb44261569eb4366447c93e (patch) | |
tree | 7c0887064f848103519ae0c0cd8f8c20debc4634 /modules | |
parent | c6a32ddb4708638e32bdc86b16339b9c0621c9c3 (diff) | |
download | gitea-f740943df4fab9c50eb44261569eb4366447c93e.tar.gz gitea-f740943df4fab9c50eb44261569eb4366447c93e.zip |
Fix markdown anchor links (#9673)
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/markup/markdown/goldmark.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/markup/markdown/goldmark.go b/modules/markup/markdown/goldmark.go index 2a2a9dce6a..a1c8e1ded0 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 |