executablebooks / sphinx-book-theme

A clean book theme for scientific explanations and documentation with Sphinx
https://sphinx-book-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
439 stars 201 forks source link

Allow scrolling to be disabled when linking to a section within a page #753

Open KevinMusgrave opened 1 year ago

KevinMusgrave commented 1 year ago

Context

If you click on this link: https://sphinx-book-theme.readthedocs.io/en/stable/components/source-files.html#source-files-repository

it starts at the top of the page, and then after a moment, scrolls down to the section.

It would be much nicer to immediately jump to the section, rather than scrolling.

For example, this link brings you to the section immediately, without any scrolling: https://kevinmusgrave.github.io/pytorch-metric-learning/losses/#histogramloss

Proposal

Allow the scrolling behavior to be disabled.

Tasks and updates

No response

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

KevinMusgrave commented 1 year ago

Adding this to a custom css file seems to work:

html {
  scroll-behavior: auto !important;
}

Is this the best approach?