Skip to content

Commit 4bee6fd

Browse files
committed
implemented heading permalinks
Signed-off-by: HIMANSHU RAI <himanshuuu.2001@gmail.com>
1 parent 5764561 commit 4bee6fd

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

assets/scss/_elements_project.scss

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,26 @@ div.tip {
149149
font-size: 1rem;
150150
font-weight: 600;
151151
word-break: break-word;
152-
}
152+
}
153+
154+
.heading-link {
155+
position: relative;
156+
display: inline-flex;
157+
align-items: center;
158+
gap: 0.3rem;
159+
160+
.heading-anchor {
161+
font-size: 0.6em;
162+
opacity: 0;
163+
transform: translateY(2px);
164+
transition: opacity 0.3s ease, transform 0.3s ease;
165+
margin-left: 0.25rem;
166+
text-decoration: none;
167+
}
168+
169+
&:hover .heading-anchor {
170+
opacity: 1;
171+
transform: translateY(0);
172+
}
173+
}
174+

assets/scss/_styles_project.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
@import "_videos_project.scss";
1212
@import "subscription.scss";
1313
@import "_video-landing_project.scss";
14+
@import "elements_project";
1415

1516
.navbar-dark {
1617
min-height: 5rem;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- $level := .Level -}}
2+
{{- $text := .Text | safeHTML -}}
3+
{{- $anchor := .Anchor | safeURL -}}
4+
5+
<h{{ $level }} id="{{ $anchor }}" class="heading-link">
6+
{{ $text }}
7+
<a class="heading-anchor" href="#{{ $anchor }}" aria-label="Anchor link to this section">
8+
🔗
9+
</a>
10+
</h{{ $level }}>

0 commit comments

Comments
 (0)