Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2022-02-19 16:16:23 +0300
committerGitHub <noreply@github.com>2022-02-19 16:16:23 +0300
commitae12d645ef0225831e59248c45689042ebdb83d2 (patch)
treed875ad4a993a9fc74d6f01bb0cb71c7f122185f1 /site/layouts
parent407af8ac7f9296627aebc1e4c5d0ee948f8be1f3 (diff)
Replace AnchorJS with a Hugo render hook (#32953)
* Replace AnchorJS with a Hugo render hook * docs(anchors): improve aria-label on anchor links * docs(anchors): show anchor link when ed * docs(anchors): add hash in pseudo-element Co-authored-by: Gaƫl Poupard <ffoodd@users.noreply.github.com>
Diffstat (limited to 'site/layouts')
-rw-r--r--site/layouts/_default/_markup/render-heading.html5
1 files changed, 5 insertions, 0 deletions
diff --git a/site/layouts/_default/_markup/render-heading.html b/site/layouts/_default/_markup/render-heading.html
new file mode 100644
index 0000000000..cfb3d8fe79
--- /dev/null
+++ b/site/layouts/_default/_markup/render-heading.html
@@ -0,0 +1,5 @@
+<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
+{{- if and (ge .Level .Page.Site.Params.anchors.min) (le .Level .Page.Site.Params.anchors.max) }}{{" " -}}
+<a class="anchor-link" href="#{{ .Anchor | safeURL }}" aria-label="Link to this section: {{ .Text | safeHTML }}"></a>
+{{- end -}}
+</h{{ .Level }}>