Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight linked anchor #869

Open
stsewd opened this issue Jan 16, 2020 · 2 comments
Open

Highlight linked anchor #869

stsewd opened this issue Jan 16, 2020 · 2 comments
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required

Comments

@stsewd
Copy link
Member

stsewd commented Jan 16, 2020

I like this from the pip docs https://pip.pypa.io/en/stable/reference/pip_wheel/#cmdoption-i

Screenshot_2020-01-16 pip wheel — pip 19 3 1 documentation

The linked anchor gets highlighted, so is easy to see the exact section that was linked. When several anchors are at the bottom of a page is hard to realize the exact section that was linked, for example https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html#using-the-project-admin-dashboard

One user proposed a solution in #877

@stsewd stsewd added the Needed: design decision A core team decision is required label Jan 16, 2020
@stsewd stsewd added the Improvement Minor improvement to code label Oct 7, 2020
@agjohnson
Copy link
Collaborator

agjohnson commented Jun 24, 2021

@nienn To expand on this issue a bit more:

  • First, target headings inside sections as a test. This would target <h1>/etc elements inside <div class="section"> elements. The div.section element has the id= attribute. For instance, we want a URL like https://sphinx-rtd-theme.readthedocs.io/en/stable/#configuration to highlight the nested heading element in <div class="section"><h1>Configuration</h1></div>

We can't yet target definition list terms, because those elements don't always have id attributes. They have id attributes in the pip docs link above because Pip uses a special Sphinx extension to output these blocks. This would be a next step later.

@agjohnson
Copy link
Collaborator

agjohnson commented Jun 24, 2021

We might also consider a general approach eventually, using :target pseudo class. This would maybe (?) allow for generic targeting. We do for instance have id attr on API docs, ie: https://sphinx-rtd-theme.readthedocs.io/en/stable/demo/api.html#test_py_module.test.Foo.add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Minor improvement to code Needed: design decision A core team decision is required
Projects
None yet
Development

No branches or pull requests

2 participants