diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 5e3a900..75f71d5 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -27,5 +27,5 @@ {{ end }} - {{ .Content }} + {{ .Content | replaceRE "()" (printf "${1}${3}" ("images/chain-link.svg" | relURL)) | safeHTML }} {{ end }} diff --git a/static/css/styles.css b/static/css/styles.css index 1cc1991..b43a677 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -13,6 +13,43 @@ h1, h2, h3, h4, h5, h6 { margin-top: 1.5em; } +@media (hover: hover) { + /* For devices which support hover, hide the heading URL fragment + link/icon until the mouse hovers over the heading */ + + h1:hover .heading-anchor, + h2:hover .heading-anchor, + h3:hover .heading-anchor, + h4:hover .heading-anchor, + h5:hover .heading-anchor, + h6:hover .heading-anchor { + visibility: visible; + } + + h1 .heading-anchor, + h2 .heading-anchor, + h3 .heading-anchor, + h4 .heading-anchor, + h5 .heading-anchor, + h6 .heading-anchor { + visibility: hidden; + } +} + +.heading-anchor { + color: grey; + margin-left: 0.5em; + font-size: 0.75em; +} + +.heading-anchor:hover { + text-decoration: none; +} + +.heading-anchor img { + height: 1em; +} + a { text-decoration: none; } diff --git a/static/images/chain-link.svg b/static/images/chain-link.svg new file mode 100644 index 0000000..a9947b2 --- /dev/null +++ b/static/images/chain-link.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + +