diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-11-19 02:15:30 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-11-19 02:15:30 +0530 |
commit | 775772b5c4d0948a984607349fbc405380879f66 (patch) | |
tree | e70f0020c8dae738b720f50a44d6a96c4d6971a5 | |
parent | ce76814d1516ee731658fe81b792a59e57286a1f (diff) |
added heading links
-rw-r--r-- | layouts/index.html | 2 | ||||
-rw-r--r-- | layouts/partials/release.html | 2 | ||||
-rw-r--r-- | static/css/styles.css | 14 |
3 files changed, 16 insertions, 2 deletions
diff --git a/layouts/index.html b/layouts/index.html index e0e8308..e815b92 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,3 +1,3 @@ {{ define "main" }} - {{ .Content }} + {{ .Content | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" "${1} <a class=\"headline-hash\" href=\"#${2}\">#</a> ${3}" | safeHTML }} {{ end }} diff --git a/layouts/partials/release.html b/layouts/partials/release.html index 1c5972a..7bd1c1a 100644 --- a/layouts/partials/release.html +++ b/layouts/partials/release.html @@ -13,4 +13,4 @@ Version number: {{ .Params.version_number }} </p> </div> -{{ .Content }} +{{ .Content | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" "${1} <a class=\"headline-hash\" href=\"#${2}\">#</a> ${3}" | safeHTML }} diff --git a/static/css/styles.css b/static/css/styles.css index e271186..f496c01 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -121,6 +121,20 @@ nav a.active { text-align: center; } +.headline-hash { + display: none; + text-decoration: none; +} + +h1:hover .headline-hash, +h2:hover .headline-hash, +h3:hover .headline-hash, +h4:hover .headline-hash, +h5:hover .headline-hash, +h6:hover .headline-hash { + display: inline; +} + .release { border: 1px solid var(--fg); padding: 5px 8px; |