Get rich tool tips in your sphinx documentation!
See the documentation for details.
Get rich tool tips in your sphinx documentation!
Home Page: https://sphinx-tippy.readthedocs.io
License: MIT License
Thanks for this amazing project! Having nice references was one major factor for us to start converting classical pdf-lecture content as sphinx/jupyterbook hmtl content for our students.
Problem:
Math references do not show any tooltip while hovering, if I use the "pydata-sphinx-theme" or "sphinx-book-theme". For the "furo" theme, everything works as expected.
Reproducibility/Minimal example:
Building the sphinx-tippy documentation as it is (with theme: "furo"), everything works as expected.
Changing the conf.py
(using the changes needed for the "pydata-sphinx-theme" according to the sphinx-tippy docs):
html_theme = "pydata_sphinx_theme"
html_static_path = ['_static']
html_css_files = ["tippy.css"]
tippy_anchor_parent_selector = "article.bd-article" #not necessary
and setting up the file _static/tippy.css
:
.tippy-box {
background-color:var(--pst-color-surface);
color:var(--pst-color-text-base);
border: 1px solid var(--pst-color-border);
}
Building the project shows the expected documentation in the new theme. All references, except the math reference, are working.
Causes/Possible Solutions:
I am not quite sure if this is just a matter of configuration or not. Since hovering over the math reference causes no response from tippy, I would assume that the equation is not detected by tippy? However, this would mean that different themes treat mathjax equations differently (at least for their default settings). I am not sure if this is true.
Do you have any ideas?
Best,
Ingo
Hello!
How can I use this package in an offline environment? I tried downloading tippy.js from https://unpkg.com/[email protected]/dist/tippy.js and put it in _static/js/tippy.js
and then my conf.py
looks like this
extensions = ["sphinx_tippy"]
templates_path = ["_templates"]
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
pygments_style = "sphinx"
html_css_files = [
"css/custom.css",
]
html_js_files = ["js/plotly.js", "js/tippy.js"]
tippy_js = ("js/tippy.js",)
But I get Uncaught ReferenceError: tippy is not defined
in firefox console
I am writing a documentation in french and I notice Wikipedia links don't work. To test that I tried the following code, and only the second link works:
:::{list-table}
- - [Ken Thompson](https://fr.wikipedia.org/wiki/Ken_Thompson)
- - [Ken Thompson](https://en.wikipedia.org/wiki/Ken_Thompson)
:::
This is because WIKI_PATH
is hardcoded in English:
sphinx-tippy/src/sphinx_tippy.py
Line 206 in cca8ea8
It would be nice to either store the whole URL for simplicity or use a tuple for wiki_titles
: (title, language)
.
When sphinx-build
is run with its -j auto
option, sphinx-tippy
doesn't work.
Indeed, consider the joined (minimal) project, the structure of which being:
├── _build
├── conf.py
├── index.rst
├── make.bat
├── Makefile
├── _static
├── _templates
└── test.rst
with the following files:
conf.py
:# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'Test tippy'
copyright = '2023, Denis'
author = 'Denis'
release = '0'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
'sphinx_tippy',
]
source_suffix = ['.rst']
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'alabaster'
html_static_path = ['_static']
index.rst
:.. Test tippy documentation master file, created by
sphinx-quickstart on Wed Sep 13 21:30:55 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Test tippy's documentation!
======================================
.. toctree::
:maxdepth: 2
:caption: Contents:
:glob:
*
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
test.rst
:Test tippy
==========
`Sphinx <https://en.wikipedia.org/wiki/Sphinx_(documentation_generator)>`__.
First, run:
sphinx-build . _build/html
and look at the _build/html/test.html
page in a browser: you'll see sphinx-tippy
works as expected when hovering over the “Sphinx” link (the target of which being https://en.wikipedia.org/wiki/Sphinx_(documentation_generator)).
Now, run:
make clean
sphinx-build -j auto . _build/html
and refresh the _build/html/test.html
page: you'll see sphinx-tippy
doesn't work anymore: nothing happens when hovering over the “Sphinx” link.
(The current feature request is a superset of #7 and #10.)
It would be nice for sphinx-tippy
to support any information exposed via json
files.
In particular, this would allow us to provide in our French LaTeX FAQ rich hover tips of the CTAN packages, thanks to https://www.ctan.org/help/json/.
Thanks @chrisjsewell for this project. I have been trying to configure sphinx-hoverxref
to work on myst-parser
with no success, so I am considering jumping ship. There is however one aspect that would be great to have from sphinx-hoverxref
is the rendering of it.
More specifically the way you can hover over to the tooltip and then scroll through it. Not having it is a bit problematic since the top-level page can easily go out of bounds in both the vertical and horizontal direction. Any ideas on how hard would be to implement this?
I have documentation that combines references to papers (crossref DOI) and arXiv preprints (datacite). Is it possible to use both resolvers?
Is there a way to customize sphinx-tippy
in order that Wikipedia tips work also with languages other than English? Indeed, in the following MWE, only “Wikipedia (en)” currently has a tooltip:
# Test
- [Wikipedia (en)](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)
- [Wikipedia (fr)](https://fr.wikipedia.org/wiki/Uniform_Resource_Identifier)
- [Wikipedia (es)](https://es.wikipedia.org/wiki/Identificador_de_recursos_uniforme)
I am referencing to tables, which are quite large, I wonder if it is possible to add css to change the font size inside the tippy?
I have been trying to adapt sphinx-hoverxref
in my documnetation project, however not being able to test it in local system was quite limiting. Found the sphinx-tippy extension
from a link to my question about the issue.
So far as basic tooltips are concerned, tippy
seems to work. I was wondering if we can change the background color from the default (which comes out as black presently) to something lighter, preferably white. With a dark background some of the texts in the tip are obscured.
Check this image:
Can you suggest a way around to do so in the present scheme of things?
If I may, there is another query:
The wikipedia tips
are quite nice. However, I was wondering if we may do a similar thing with other sources, say an imdb
page?
Environment:
Python Version: 3.8.10
Sphinx Version: 4.5
sphinx-tippy Version: 0.4.3
Jupyter Book Version: 0.15.1
Expected Behavior:
I would expect that LaTeX or MathJax formatted mathematics within sphinx-tippy tooltips, especially when these tooltips reference content from sphinx-proof admonitions, should render correctly, similar to other parts of my Jupyter Book documentation.
Actual Behavior:
Unfortunately, I've noticed that mathematical expressions within sphinx-tippy tooltips that reference sphinx-proof admonitions do not render as expected. Instead of seeing formatted mathematics, the raw LaTeX strings are displayed.
Steps to Reproduce:
We would like to be able to support the duration parameter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.