-
Notifications
You must be signed in to change notification settings - Fork 40
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
Support glossary
/ term
and sphinxcontrib-bibtex
#149
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@Book{1987:nelson, | ||
author = {Edward Nelson}, | ||
title = {Radically Elementary Probability Theory}, | ||
publisher = {Princeton University Press}, | ||
year = {1987} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,44 @@ To enable ``hoverxref`` on a domain, you need to use the config :confval:`hoverx | |
indicating which are the domains you desire. | ||
|
||
|
||
Tooltip on glossary terms | ||
------------------------- | ||
|
||
You can add tooltips to glossary terms: | ||
|
||
.. code-block:: rst | ||
See the :term:`sphinx:environment` definition in the glossary. | ||
That will render to: | ||
|
||
See the :term:`sphinx:environment` definition in the glossary. | ||
|
||
To enable ``hoverxref`` on glossary terms, you need to add ``'term'`` to :confval:`hoverxref_roles`. | ||
|
||
|
||
Tooltip on sphinxcontrib-bibtex cites | ||
------------------------------------- | ||
|
||
If you want to show a tooltip on `sphinxcontrib-bibtex <https://sphinxcontrib-bibtex.readthedocs.io/en/latest/>`_ cites, | ||
you just need to enable it in :confval:`hoverxref_domains` by adding ``'cite'`` to that list. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should standardize where we put this info. It's at the bottom of the previous section, and top here. Probably a subhead like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a |
||
Example: | ||
|
||
.. code-block:: rst | ||
See :cite:t:`1987:nelson` for an introduction to non-standard analysis. | ||
Non-standard analysis is fun :cite:p:`1987:nelson`. | ||
See :cite:t:`1987:nelson` for an introduction to non-standard analysis. | ||
Non-standard analysis is fun :cite:p:`1987:nelson`. | ||
|
||
.. note:: | ||
|
||
Note that tooltips on sphinxcontrib-bibtex are supported on ``Sphinx>=2.1`` only. | ||
|
||
.. bibliography:: | ||
|
||
|
||
Tooltip with content that needs extra rendering steps | ||
----------------------------------------------------- | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# conf.py to run tests | ||
|
||
master_doc = 'index' | ||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.autosectionlabel', | ||
'hoverxref.extension', | ||
'sphinxcontrib.bibtex', | ||
] | ||
|
||
bibtex_bibfiles = ['refs.bib'] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sphinxcontrib-bibtex Domain | ||
=========================== | ||
|
||
This is an example page with a sphinxcontrib-bibtex Domain role usage. | ||
|
||
See :cite:t:`1987:nelson` for an introduction to non-standard analysis. | ||
Non-standard analysis is fun :cite:p:`1987:nelson`. | ||
|
||
|
||
.. bibliography:: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@Book{1987:nelson, | ||
author = {Edward Nelson}, | ||
title = {Radically Elementary Probability Theory}, | ||
publisher = {Princeton University Press}, | ||
year = {1987} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Glossary | ||
======== | ||
|
||
Example page showing the usage of ``.. glossary`` and ``term``. | ||
|
||
See definition :term:`builder` for more information. | ||
|
||
.. copied from https://www.sphinx-doc.org/en/master/glossary.html | ||
.. glossary:: | ||
|
||
builder | ||
A class (inheriting from :class:`~sphinx.builders.Builder`) that takes | ||
parsed documents and performs an action on them. Normally, builders | ||
translate the documents to an output format, but it is also possible to | ||
use builders that e.g. check for broken links in the documentation, or | ||
build coverage information. | ||
|
||
See :doc:`/usage/builders/index` for an overview over Sphinx's built-in | ||
builders. | ||
|
||
configuration directory | ||
The directory containing :file:`conf.py`. By default, this is the same as | ||
the :term:`source directory`, but can be set differently with the **-c** | ||
command-line option. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ envlist = | |
deps = | ||
pytest | ||
pdbpp | ||
sphinxcontrib-bibtex | ||
. | ||
sphinx18: sphinx~=1.8.0 | ||
sphinx20: sphinx~=2.0.0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this enabled by default? I feel like it should be..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to not enable tooltips by default. The extension itself has a
:hoverxref:
role where you can manually specify which references you want to show tooltips on.Besides, it has a simplified way to enable tooltips on all references by using
hoverxref_auto_ref = True
in your config file or selectively by role usinghoverxref_roles
.