Skip to content

Commit dd1e0fa

Browse files
committed
Add sphinx-hoverxref example page
1 parent 2070916 commit dd1e0fa

File tree

5 files changed

+94
-2
lines changed

5 files changed

+94
-2
lines changed

docs/_config.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Book settings
22
# Learn more at https://jupyterbook.org/customize/config.html
3+
# Comprehensive example: https://github.com/executablebooks/jupyter-book/blob/master/docs/_config.yml
34

45
title: Example Jupyter Book for Read the Docs
56
author: Read the Docs team
@@ -30,3 +31,31 @@ repository:
3031
html:
3132
use_issues_button: true
3233
use_repository_button: true
34+
35+
sphinx:
36+
config:
37+
intersphinx_mapping:
38+
ebp:
39+
- "https://executablebooks.org/en/latest/"
40+
- null
41+
myst-parser:
42+
- "https://myst-parser.readthedocs.io/en/latest/"
43+
- null
44+
myst-nb:
45+
- "https://myst-nb.readthedocs.io/en/latest/"
46+
- null
47+
sphinx:
48+
- "https://www.sphinx-doc.org/en/master"
49+
- null
50+
nbformat:
51+
- "https://nbformat.readthedocs.io/en/latest"
52+
- null
53+
sd:
54+
- https://sphinx-design.readthedocs.io/en/latest
55+
- null
56+
57+
extra_extensions:
58+
- sphinx_inline_tabs
59+
- sphinx_proof
60+
- sphinx_examples
61+
- hoverxref.extension

docs/_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ chapters:
77
- file: markdown
88
- file: notebooks
99
- file: markdown-notebooks
10+
- file: sphinx-hoverxref

docs/intro.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,38 @@
1+
(intro)=
2+
13
# Jupyter Book on Read the Docs
24

3-
This example shows a Jupyter Book project built and published on Read the Docs. You're encouraged to view it to get inspiration and copy & paste from the files in [the source code][github]. If you are using Read the Docs for the first time, have a look at the official [Read the Docs Tutorial][tutorial]. If you are using Jupyter Book for the first time, have a look at the [official Jupyter Book documentation][jb-docs].
5+
This example shows a Jupyter Book project built and published on Read the Docs.
6+
You're encouraged to view it to get inspiration and copy & paste from the files in [the source code repository][github], where you will also find the relevant configuration for building Jupyter Book projects on Read the Docs.
7+
If you are using Read the Docs for the first time, have a look at the official [Read the Docs Tutorial][tutorial].
8+
If you are using Jupyter Book for the first time, have a look at the [official Jupyter Book documentation][jb-docs].
9+
10+
## Why run Jupyter Book with Read the Docs?
11+
12+
[Read the Docs](https://readthedocs.org/) simplifies developing Jupyter Book projects by automating building, versioning, and hosting of your project for you.
13+
You might be familiar with Read the Docs for software documentation projects, but these features are just as relevant for science.
14+
15+
With Read the Docs, you can improve collaboration on your Jupyter Book project with Git (GitHub, GitLab, BitBucket etc.) and then connect the Git repository to Read the Docs.
16+
Once Read the Docs and the git repository are connected, your project will be built and published automatically every time you commit and push changes with git.
17+
Furthermore, if you open Pull Requests, you can preview the result as rendered by Jupyter Book.
18+
19+
## What is in this example?
20+
21+
Jupyter Book has a number of built-in features, which you can see examples of here:
22+
23+
* [Examples of Markdown](/markdown)
24+
* [Rendering a notebook Jupyter Notebook](/notebooks)
25+
* [A notebook written in MyST Markdown](/markdown-notebooks)
26+
27+
We have also added some popular features for Jupyter Book that really you shouldn't miss when building your own project:
28+
29+
* [intersphinx to link to other documentation and Jupyter Book projects](/sphinx-hoverxref)
30+
* [sphinx-examples to show examples and results side-by-side](/sphinx-hoverxref)
31+
* [sphinx-hoverxref to preview cross-references](/sphinx-hoverxref)
32+
* [sphinx-proof for logic and math, to write proofs, theorems, lemmas etc.](/sphinx-hoverxref)
33+
* [sphinx-inline-tabs to display alternatives side-by-side with a tabbed interface](/sphinx-hoverxref)
434

5-
# Jupyter Book examples
35+
## Jupyter Book examples
636

737
This is a small sample book to give you a feel for how book content is
838
structured.

docs/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
jupyter-book
22
matplotlib
33
numpy
4+
sphinx-inline-tabs
5+
sphinx-examples
6+
sphinx-proof
7+
sphinx-hoverxref

docs/sphinx-hoverxref.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# sphinx-hoverxref - preview cross-references
2+
3+
Using sphinx-hoverxref, we can preview cross-references in the documentation.
4+
5+
For instance, try placing your mouse over {hoverxref}`this reference to the front page <intro>`.
6+
We have used a named "target" for the reference. Here are some examples of how to name your targets:
7+
8+
```{tab} reStructuredText
9+
10+
```rest
11+
.. _foobar:
12+
13+
My Headline
14+
===========
15+
16+
Here is a paragraph, we link to this headline :hoverxref:`like this <foobar>`
17+
```
18+
19+
```{tab} MyST
20+
21+
```markdown
22+
23+
(foobar)=
24+
25+
# My Headline
26+
27+
Here is a paragraph, we link to this headline {hoverxref}`like this <foobar>`.
28+
```

0 commit comments

Comments
 (0)