<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <id>https://blog.readthedocs.com</id>
  <title>Read the Docs Blog - Posts tagged czi-grant</title>
  <updated>2023-07-08T10:50:30.136986+00:00</updated>
  <link href="https://blog.readthedocs.com"/>
  <link href="https://blog.readthedocs.com/archive/tag/czi-grant/atom.xml" rel="self"/>
  <generator uri="https://ablog.readthedocs.org/" version="0.10.26">ABlog</generator>
  <entry>
    <id>https://blog.readthedocs.com/hoverxref-intersphinx/</id>
    <title>New release of sphinx-hoverxref with support for intersphinx</title>
    <updated>2021-06-10T00:00:00+00:00</updated>
    <author>
      <name>Juan Luis Cano Rodríguez</name>
    </author>
    <content type="html">&lt;section id="new-release-of-sphinx-hoverxref-with-support-for-intersphinx"&gt;

&lt;p&gt;We have released version 0.6b1 of &lt;a class="reference external" href="https://sphinx-hoverxref.readthedocs.io/"&gt;sphinx-hoverxref&lt;/a&gt;,
a Sphinx extension that shows a &lt;em&gt;content preview&lt;/em&gt;
of a cross-reference.&lt;/p&gt;
&lt;p&gt;This extension is an essential part
of the work we are doing to improve interoperability of documentation in general,
and scientific documentation in particular,
thanks to the &lt;a class="reference external" href="/czi-grant-announcement"&gt;CZI grant&lt;/a&gt; we received last year.&lt;/p&gt;
&lt;figure class="align-center" id="id1"&gt;
&lt;a class="reference external image-reference" href="/_images/sphinx-hoverxref-showcase.gif"&gt;&lt;img alt="sphinx-hoverxref displaying tooltips for cross references" src="../../../_images/sphinx-hoverxref-showcase.gif" style="width: 60%;" /&gt;&lt;/a&gt;
&lt;figcaption&gt;
&lt;p&gt;&lt;span class="caption-text"&gt;sphinx-hoverxref displaying a tooltip including an equation&lt;/span&gt;&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;section id="embedding-content-previews"&gt;
&lt;h2&gt;Embedding content previews&lt;/h2&gt;
&lt;p&gt;Technical documentation is full of cross-references (or &lt;em&gt;xrefs&lt;/em&gt;):
hyperlinks to related parts of the documentation (or even to an external project)
that help contextualize the information.
&lt;a class="reference external" href="https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html"&gt;Sphinx provides powerful tools for creating
xrefs&lt;/a&gt;,
which can be used to link other parts of the documentation,
and in the case of software projects, also to specific objects of the API.&lt;/p&gt;
&lt;p&gt;However, jumping through several links while reading some documentation
can be distracting, since opening them might need either a context switch
or keeping a new browser tab for a later moment.&lt;/p&gt;
&lt;p&gt;Here is where &lt;a class="reference external" href="https://sphinx-hoverxref.readthedocs.io/"&gt;sphinx-hoverxref&lt;/a&gt; comes to the rescue:
it scans the cross-references and attaches content previews to them
(either &lt;em&gt;tooltips&lt;/em&gt; or &lt;em&gt;modal&lt;/em&gt; dialogues)
that embed the contents of the page the xrefs point to.
This way, when the user is interested in a particular topic,
they can hover the mouse over the link
and display the content preview
instead of opening the link.&lt;/p&gt;
&lt;p&gt;Moreover, the content previews created by &lt;a class="reference external" href="https://sphinx-hoverxref.readthedocs.io/"&gt;sphinx-hoverxref&lt;/a&gt;
also work if the embedded content requires a particular extension to be rendered.
This makes it possible to embed content that includes mathematical equations, for example.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="support-for-intersphinx"&gt;
&lt;h2&gt;Support for &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;intersphinx&lt;/span&gt;&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Version 0.6b1 of &lt;a class="reference external" href="https://sphinx-hoverxref.readthedocs.io/"&gt;sphinx-hoverxref&lt;/a&gt; introduces opt-in support for Intersphinx linking.
&lt;a class="reference external" href="https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html"&gt;sphinx.ext.intersphinx&lt;/a&gt;
is a Sphinx extension
that generates automatic links to the documentation of objects in other projects,
and now it’s possible to show floating windows on them too.&lt;/p&gt;
&lt;figure class="align-center" id="id2"&gt;
&lt;a class="reference external image-reference" href="/_images/sphinx-hoverxref-intersphinx.png"&gt;&lt;img alt="A project (left) embedding content from another project linked through intersphinx (right) using sphinx-hoverxref" src="../../../_images/sphinx-hoverxref-intersphinx.png" style="width: 80%;" /&gt;&lt;/a&gt;
&lt;figcaption&gt;
&lt;p&gt;&lt;span class="caption-text"&gt;A project (left) embedding content from another project linked through intersphinx (right)
using sphinx-hoverxref&lt;/span&gt;&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;To enable it, the user needs to specify
which projects from the &lt;a class="reference external" href="https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#confval-intersphinx_mapping"&gt;intersphinx_mapping&lt;/a&gt;
will be scanned by &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;sphinx-hoverxref&lt;/span&gt;&lt;/code&gt;, using a new configuration value:&lt;/p&gt;
&lt;div class="highlight-python notranslate"&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;# Values of the intersphinx_mapping keys that you want to enable hoverxref on&lt;/span&gt;
&lt;span class="n"&gt;hoverxref_intersphinx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
   &lt;span class="s2"&gt;&amp;quot;astropy&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s2"&gt;&amp;quot;numpy&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s2"&gt;&amp;quot;scipy&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s2"&gt;&amp;quot;matplotlib&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Moreover, the look &amp;amp; feel of the current project is preserved
even if the target documentation has a different theme or colors,
which makes the result more visually consistent.&lt;/p&gt;
&lt;div class="admonition note"&gt;
&lt;p class="admonition-title"&gt;Note&lt;/p&gt;
&lt;p&gt;At the moment, the target project needs to be hosted on Read the Docs,
which is a limitation that we hope to remove in the future.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can draw inspiration from some community projects that are using this feature already:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://grill.readthedocs.io/"&gt;The Grill&lt;/a&gt;, an extension for digital content creation with Maya, Houdini, and other 3D modeling applications,
and references another project called &lt;a class="reference external" href="https://naming.readthedocs.io/"&gt;naming&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://docs.poliastro.space/"&gt;poliastro&lt;/a&gt;, a Python library for interactive Astrodynamics
that makes cross-references to &lt;a class="reference external" href="https://docs.astropy.org/"&gt;Astropy&lt;/a&gt; and other projects.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We are excited to see what our users can do with &lt;a class="reference external" href="https://sphinx-hoverxref.readthedocs.io/"&gt;sphinx-hoverxref&lt;/a&gt;,
and will continue working on it in the future.&lt;/p&gt;
&lt;p&gt;Considering using Read the Docs for your next Sphinx or MkDocs project?
Check out &lt;a class="reference external" href="https://docs.readthedocs.io/"&gt;our documentation&lt;/a&gt; to get started!&lt;/p&gt;
&lt;/section&gt;
&lt;/section&gt;
</content>
    <link href="https://blog.readthedocs.com/hoverxref-intersphinx/" rel="alternate"/>
    <summary>We have released version 0.6b1 of sphinx-hoverxref,
a Sphinx extension that shows a content preview
of a cross-reference.This extension is an essential part
of the work we are doing to improve interoperability of documentation in general,
and scientific documentation in particular,
thanks to the CZI grant we received last year.</summary>
    <category term="czi" label="czi"/>
    <category term="grant" label="grant"/>
    <category term="czi-grant" label="czi-grant"/>
    <category term="embed" label="embed"/>
    <category term="sphinx-hoverxref" label="sphinx-hoverxref"/>
    <published>2021-06-10T00:00:00+00:00</published>
  </entry>
</feed>
