Giter VIP home page Giter VIP logo

sphinx-tippy's Introduction

sphinx-tippy

GitHub Repo stars

Get rich tool tips in your sphinx documentation!

See the documentation for details.

sphinx-tippy's People

Contributors

ccoveille avatar chrisjsewell avatar jdillard avatar pre-commit-ci[bot] avatar valmystletainn avatar wlach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sphinx-tippy's Issues

Tippy css for light mode only with Furo

Hello,

first of all, thanks for the package!

I'm having an issue where I want to only change the tippy's css when Furo is in Light mode. The tippys are fine in Dark mode but not readable in Light mode:

Link issue:

SCR-20230831-isxt

Inline code issue:
SCR-20230831-iswx

Any advice on how to procede?

Thanks!

Math references not working in different themes

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

How to use in offline environment?

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

Wiki links with different languages

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:

WIKI_PATH = "https://en.wikipedia.org/wiki/"

It would be nice to either store the whole URL for simplicity or use a tuple for wiki_titles: (title, language).

Doesn't work with `-j auto` option

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`
  • and an auxiliary 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.

test-tippy.tar.gz

Scrollable tooltip

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?

Wikipedia tips work also with languages other than English?

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)

How to change font-size of tippy?

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?

Can we tweak the background color of the tooltips

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:

example_tip

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?

Math Not Rendering in sphinx-tippy Tooltips for Admonition References

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:

  1. Set up sphinx-tippy in a Jupyter Book project incorporating sphinx-proof for creating structured content like theorems.
  2. Include a LaTeX expression in a tooltip that references a theorem or an admonition.
  3. Build the Jupyter Book and hover over the referenced tooltip.
  4. Note that the tooltip displays the raw LaTeX markup instead of the expected formatted mathematical expression.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.