Coder Social home page Coder Social logo

Comments (9)

chrisjsewell avatar chrisjsewell commented on August 11, 2024 4

Hey gang, so yeh I wanted this also, plus didn't really like the whole having to have it hosted on RTD to get it working.

So I created my own extension 😅, that works by pre-compiling all the tips, rather than fetching them interactively (and also supports other APIs like wikipedia and DOI)

Here it is: https://sphinx-tippy.readthedocs.io, and you can see it in action on https://myst-parser.readthedocs.io

happy to work with you guys on it

from sphinx-hoverxref.

humitos avatar humitos commented on August 11, 2024 2

Hi all! I don't have too much experience working with MyST and how it generates the nodes. It makes sense that it works when using {ref} in your links since that's a Sphinx role and it's translated into a ref node in docutils.

However, I'm not sure to what node [text](file#header) translates to. We will need to figure it out that first. Once we know it, we can probably add a small chunk of code to this extension to handle those as ref as well.

from sphinx-hoverxref.

FlyingToto avatar FlyingToto commented on August 11, 2024 2

Hello Everyone,
I am sorry but I can't figure out from the docs above how to get these tippy tooltips to work with Myst Markdown.
We use: md files -> myst -> sphinx -> github -> readthedocs

We basically have 3 simple use-cases when the mouse hovers our keyword 'foo':

  • show 1 line tooltip: just display the string "Hello World!"
  • show multi-lines tooltip: just display the text:
    "Hello line1 !
    Hello line2!"
    when the mouse over the keyword.
  • show a box with the content of another html page: hello_world.html ? (although I assume we write the file as hello_world.md and it get translated to hello_world.html by myst+sphinx)

...I am very new to this whole markdown things, so I apologize if my question is somehow obvious...
for instance for item 1,
I did add to my md file: "Custom tip" which I stole from your tippy doc source code.
but it only show the link in the bottom left corner of my browser no tooltip is showing.
I think I did configure some of tippy properly because I do see some tooltip showing up when I hover over some of my headers in the menu...

Thank you so much!

from sphinx-hoverxref.

jhj0411jhj avatar jhj0411jhj commented on August 11, 2024

I've noticed this issue #114. And I find the ref syntex provided by my-st is useful: https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html#targets-and-cross-referencing

{ref}`my text <header_target>`

I'm wondering whether hoverxref_auto_ref can identify and convert markdown links ({any} role?) written by [name](file) automatically.

from sphinx-hoverxref.

jhj0411jhj avatar jhj0411jhj commented on August 11, 2024

I find a solution.

First, generate section label:

extensions += ['sphinx.ext.autosectionlabel']
# Make sure the target is unique
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = None

Then use {ref} provided by myst-parser in markdown:

{ref}`design principle <overview/overview:design principle>`

hoverxref will identify the ref above.

However, the markdown links cannot be identified:

using sphinx.ext.autosectionlabel:
[](<overview/overview:design principle>)

using markdown anchor. for example, set `myst_heading_anchors = 3` 
[](../overview/overview.md#design-principle)

So I have to rewrite all my links using {ref}. Is there any way to avoid rewriting existing markdown links ([text](file#header))?

from sphinx-hoverxref.

kiteloopdesign avatar kiteloopdesign commented on August 11, 2024

Hi, same question/issue here with Myst markdown in Sphinx. Commenting here for visibility.

from sphinx-hoverxref.

benjaoming avatar benjaoming commented on August 11, 2024

What do you make of these @humitos ?

https://myst-parser.readthedocs.io/en/latest/develop/architecture.html#a-sphinx-parser
https://myst-parser.readthedocs.io/en/latest/develop/background.html#the-relationship-between-myst-restructuredtext-and-sphinx

from sphinx-hoverxref.

LecrisUT avatar LecrisUT commented on August 11, 2024

Am I doing something wrong, or are external roles not supported? I tried on a .md file as:

{external+rtd:std:doc}`test<intro/getting-started-with-sphinx>`

but that did not seem to work. ref with hoverxref_auto_ref seemed to work, but I am not sure how to translate the equivalent of <inv:rtd:std:doc#intro/getting-started-with-sphinx> to that. I've also tried doc as:

{doc}`test<rtd:index>`

~~but that did not work either. ~~ Actually it works, I did not configure hoverxref_intersphinx appropriately

Basically what would be the minimum setup and supported roles that could be used? Ideally compared to myst documentation here and here

from sphinx-hoverxref.

LecrisUT avatar LecrisUT commented on August 11, 2024

@humitos is this reference useful? Or maybe the class of that caller is needed?

from sphinx-hoverxref.

Related Issues (20)

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.