Merge pull request #1254 from SmileGuide/patch-4

🐛 Anchors Not Functioning Correctly for CJK Headings
This commit is contained in:
Nuno Coração 2024-02-21 10:05:32 +00:00 committed by GitHub
commit a3583482b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,10 +1,12 @@
{{ $strAnchor := urlize .Anchor }}
{{ $replacedAnchor := replaceRE "%25" "" $strAnchor }}
<h{{ .Level }} class="relative group">{{ .Text | safeHTML }} <h{{ .Level }} class="relative group">{{ .Text | safeHTML }}
<div id="{{ .Anchor | safeURL }}" class="anchor"></div> <div id="{{ .Anchor | safeURL | urlize }}" class="anchor"></div>
{{ if.Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }} {{ if.Page.Params.showHeadingAnchors | default (.Page.Site.Params.article.showHeadingAnchors | default true) }}
<span <span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100"> class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
<a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" <a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700"
style="text-decoration-line: none !important;" href="#{{ .Anchor | safeURL }}" aria-label="{{ i18n "article.anchor_label" }}">#</a> style="text-decoration-line: none !important;" href="#{{ $replacedAnchor | safeURL }}" aria-label="{{ i18n "article.anchor_label" }}">#</a>
</span> </span>
{{ end }} {{ end }}
</h{{ .Level }}> </h{{ .Level }}>