This repository was archived by the owner on Apr 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Support glossary
/ term
and sphinxcontrib-bibtex
#149
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
----------------------------------------------------- | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
.