chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity
Other
582 stars 267 forks source link

A TOC anchor link/header is hidden behind the navigation bar. #295

Closed georgew509 closed 2 years ago

georgew509 commented 2 years ago

I have checked all the prerequisites below and I'm yet experiencing a problem

I am seeing a minor issue with the table of contents option (toc: true). You can see an example at: https://altoplace.org/posts/2021/configure-apache-and-php-fpm-on-macos/

When you click on a TOC link, the document scrolls to the correct location, but the anchor/header is hidden behind the navigation bar. I would prefer seeing the anchor/header displayed just under the navigation bar to give a confirmation that the document has scrolled to the correct location.

I don't know if this is really a bug or a possible enhancement.

chipzoller commented 2 years ago

This is how anchoring works in all of Markdown and the HTML rendered from it. Nevertheless, we will take this as a possible enhancement request.

rootwork commented 2 years ago

The way I'm handling this on my own site is by using scroll-margin-top, which is surprisingly well-supported for being a relatively unknown CSS property. Basically you apply it to the headings themselves, using the height of the header. I'll write up a PR for this unless someone gets to it before me...