Add article heading anchors

Adds heading anchors (#) that appear when user hovers over headings in
articles. Clicking the anchor will scroll viewport until heading is
aligned to top and update the address bar with the hash. This makes it
easy to copy URLs that link to a specific heading in the article.
This commit is contained in:
Sangeeth Sudheer 2024-11-17 16:24:22 +05:30
parent 4e760d1c8d
commit 62972cfe7a
No known key found for this signature in database
GPG key ID: F6D06ECE734C57D1
2 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,4 @@
<h{{ .Level }} class="heading" id="{{ .Anchor }}">
{{ .Text }}
<a href="#{{ .Anchor }}">#</a>
</h{{ .Level }}>