Customize footnote backlink text in Goldmark

Is there an equivalent of footnoteReturnLinkContents for Goldmark?

Related: if my understanding that footnoteReturnLinkContents is in fact specific to Blackfriday, then it would seem that these docs should be updated to call this out as only working for Blackfriday, or possibly even remove in favor of the Blackfriday specific docs. Happy to open a PR for this if appropriate.

No. Currently you cannot configure the options for the Goldmark footnote extension.

Yes please:

I would remove both footnoteAnchorPrefix and footnoteReturnLinkContents from:

They’re both documented here:

Done: Remove footnoteAnchorPrefix and footnoteReturnLinkContents by AlanBreck · Pull Request #1704 · gohugoio/hugoDocs · GitHub


1 Like

I’ve been able to customize the Footnote Return Link while using Goldmark Goldmark, and IIRC this code is responsible for that:

        <!-- Print the Content but replace the Footnote return link -->
        {{ $footnoteReturnLink := (printf "${1}%s${2}" "↥↥") }}
        {{ .Content | replaceRE "(<a (?:.*) class=\"footnote-backref\" (?:.*)>)(?:.*)(</a>)" $footnoteReturnLink | safeHTML }}

I put this code in single.html where the post content is being called.

See live at the bottom of
Source: Controlling Goldmark footnote rendering - #5 by sephore

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.