Open stsewd opened 4 years ago
@nienn To expand on this issue a bit more:
<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.
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
I like this from the pip docs https://pip.pypa.io/en/stable/reference/pip_wheel/#cmdoption-i
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 https://github.com/readthedocs/sphinx_rtd_theme/issues/877