themes/dasharo/layouts/_default/_markup/: add render-heading.html for anchor mechanism

Signed-off-by: Artur Raglis <artur.raglis@3mdeb.com>
This commit is contained in:
Artur Raglis
2026-05-15 15:28:47 +02:00
parent cbaff6008b
commit 1a00ee5a0f
2 changed files with 24 additions and 0 deletions
+23
View File
@@ -46,6 +46,29 @@
span {
color: $grey;
}
.heading-anchor {
display: inline-flex;
align-items: center;
margin-left: 0.35em;
opacity: 0;
transition: opacity 0.2s ease;
color: $grey;
text-decoration: none;
vertical-align: middle;
svg {
fill: currentColor;
}
&:hover {
color: $greenTwo;
}
}
&:hover .heading-anchor {
opacity: 1;
}
}
.terms__content-description {
@@ -0,0 +1 @@
{{ $id := .PlainText | lower | replaceRE "[^a-z0-9]+" "-" | replaceRE "^-|-$" "" }}<h{{ .Level }} id="{{ $id }}"{{ range $k, $v := .Attributes }} {{ $k }}="{{ $v }}"{{ end }}>{{ .Text | safeHTML }}{{ if eq .Page.Layout "terms" }}<a href="#{{ $id }}" class="heading-anchor" aria-label="Link to this section"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"/></svg></a>{{ end }}</h{{ .Level }}>