Skip to content

Add custom embed views for intersphinx #1812

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

Closed
ericholscher opened this issue Nov 9, 2015 · 10 comments
Closed

Add custom embed views for intersphinx #1812

ericholscher opened this issue Nov 9, 2015 · 10 comments
Labels
Accepted Accepted issue on our roadmap Feature New feature

Comments

@ericholscher
Copy link
Member

We have the embed tooling, and intersphinx. It would be cool to build a basic UI that would do an embed on hover for intersphinx links. This would allow folks to see the referenced documentation inline, without having to click out.

@ericholscher ericholscher added the Improvement Minor improvement to code label Nov 9, 2015
@stsewd
Copy link
Member

stsewd commented Aug 31, 2018

Related to #1758

@ericholscher
Copy link
Member Author

GitHub now does this on issue/PR hover, which is a great implementation of it.

@ericholscher
Copy link
Member Author

Wikipedia also does a version of this.

@ericholscher
Copy link
Member Author

More details of the Wikipedia version: https://www.mediawiki.org/wiki/Page_Previews

@stale
Copy link

stale bot commented Jan 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: stale Issue will be considered inactive soon label Jan 10, 2019
@ericholscher
Copy link
Member Author

Still working on this, need to finish it up :)

@stale stale bot removed the Status: stale Issue will be considered inactive soon label Jan 10, 2019
@humitos humitos added the Accepted Accepted issue on our roadmap label Jan 10, 2019
@humitos humitos added Feature New feature and removed Improvement Minor improvement to code labels May 23, 2019
@humitos
Copy link
Member

humitos commented May 23, 2019

I've been thinking a little more about this and how to emulate the Github behavior in our docs: when you hover an issue number in a Github conversation it shows a small popup with some useful information about it

Screenshot_2019-05-23_12-41-32

I think we could do something similar in a separate Sphinx extension (outside our core repository) without any change in our current source code. My idea is to override the ref Sphinx role to add a Javascript hover event and some data- attributes to the anchor link.

Example

The author writes,

:ref:`how to migrate from v1 <config-file/v2:Migrating from v1>`.

and the HTML rendered is,

<a class="reference internal" 
   href="v2.html#migrating-from-v1"
   data-project="docs"
   data-version="stable"
   data-doc="config-file/v2"
   data-section='Migrating from v1">
  <span class="std std-ref">how to migrate from v1</span>
</a> 

data-project and data-version could be got from a global setting since it will be the same for all the links.

with a Javascript event linked to an API call for,

https://readthedocs.org/api/v1/embed/?project=docs&version=stable&doc=config-file/v2&section=Migrating%20from%20v1

@ericholscher
Copy link
Member Author

Yea, I don't think we need much new backend code, just frontend/JS.

@humitos
Copy link
Member

humitos commented Jun 2, 2019

I started writing this extension at https://github.com/humitos/sphinx-hoverxref

There is a first implementation for the Python side of the extension already done that adds the attributes to the <a> tags that are mentioned in the previous comment. There are some things that can be added to be more configurable, though.

Front-end part is coming soon, but I will probably need some help to make it work nicely.

@humitos
Copy link
Member

humitos commented Aug 25, 2019

I'm closing this issue.

We have the extension built already and a beta release was published. There is no big known issues currently.

In any case, we can track these problems on its own repository: https://github.com/readthedocs/sphinx-hoverxref

@humitos humitos closed this as completed Aug 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Feature New feature
Projects
None yet
Development

No branches or pull requests

3 participants