Skip to content

Commit 2294d27

Browse files
committed
Merge branch 'bootstrap' of github.com:readthedocs-examples/example-jupyter-book into bootstrap
2 parents 076b0a7 + 4f47b57 commit 2294d27

File tree

6 files changed

+106
-22
lines changed

6 files changed

+106
-22
lines changed

docs/_config.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,25 @@ sphinx:
5151
- "https://nbformat.readthedocs.io/en/latest"
5252
- null
5353
sd:
54-
- https://sphinx-design.readthedocs.io/en/latest
54+
- "https://sphinx-design.readthedocs.io/en/latest"
5555
- null
56-
56+
sphinxproof:
57+
- "https://sphinx-proof.readthedocs.io/en/latest/"
58+
- null
59+
hoverxref_intersphinx:
60+
- "sphinxproof"
61+
mathjax3_config:
62+
tex:
63+
macros:
64+
"N": "\\mathbb{N}"
65+
"floor": ["\\lfloor#1\\rfloor", 1]
66+
"bmat": ["\\left[\\begin{array}"]
67+
"emat": ["\\end{array}\\right]"]
68+
5769
extra_extensions:
70+
- sphinx.ext.intersphinx
5871
- sphinx_inline_tabs
5972
- sphinx_proof
6073
- sphinx_examples
61-
- hoverxref.extension
74+
- hoverxref.extension
75+

docs/_toc.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@
33

44
format: jb-book
55
root: intro
6-
chapters:
7-
- file: markdown
8-
- file: notebooks
9-
- file: markdown-notebooks
10-
- file: sphinx-hoverxref
6+
parts:
7+
- caption: Basic examples 🪄
8+
chapters:
9+
- file: markdown
10+
- file: notebooks
11+
- file: markdown-notebooks
12+
- caption: Cool extensions 🕶️
13+
chapters:
14+
- file: intersphinx
15+
- file: sphinx-examples
16+
- file: sphinx-hoverxref
17+
- file: sphinx-proof
18+

docs/intersphinx.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Intersphinx
2+
3+
Behind the built-in Sphinx extension `intersphinx` is a powerful tool to reference sections in other Sphinx and Jupyter Book documentation projects.
4+
5+
You can configure mappings to external Sphinx projects in your Jupyter Book configuration, the `_config.yml` file. In this example project, we have configured `ebp` to reference `https://executablebooks.org/en/latest/`. In the following code examples, we refer to the configured `ebp` mapping and link directly to a section called `tools`.
6+
7+
```{tab} MyST (Markdown)
8+
9+
```{example}
10+
We can link to pages in other documentation projects.
11+
This is a link to the
12+
[Executable Book project's list of tools they build](ebp:tools)
13+
```
14+
15+
16+
```{tab} reStructuredText
17+
18+
```{example}
19+
20+
```{eval-rst}
21+
We can link to pages in other documentation projects.
22+
This is a link to the
23+
:doc:`Executable Book project's list of tools they build <ebp:tools>`
24+
```
25+
26+
```{note}
27+
In the above `reStructuredText` example, we use `{eval-rst}` to write reST inside a `.md` file (i.e. the one you are reading now). You only need to use this directive if you are writing reST code in a `.md` file.
28+
```

docs/intro.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,42 @@
33
# Jupyter Book on Read the Docs
44

55
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.
6+
You're encouraged to use it to get inspiration and copy & paste from the files in [the source code repository][github]. In the source repository, you will also find the relevant configuration and instructions for building Jupyter Book projects on Read the Docs.
7+
78
If you are using Read the Docs for the first time, have a look at the official [Read the Docs Tutorial][tutorial].
89
If you are using Jupyter Book for the first time, have a look at the [official Jupyter Book documentation][jb-docs].
910

1011
## Why run Jupyter Book with Read the Docs?
1112

1213
[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+
You might be familiar with Read the Docs for software documentation projects, but these features are just as relevant for science.
1415

1516
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.
1617
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.
1718
Furthermore, if you open Pull Requests, you can preview the result as rendered by Jupyter Book.
1819

1920
## What is in this example?
2021

21-
Jupyter Book has a number of built-in features, which you can see examples of here:
22+
Jupyter Book has a number of built-in features.
23+
This is a small example book to give you a feel for how book content is structured.
24+
It shows off a few of the major file types, as well as some sample content.
25+
It does not go in-depth into any particular topic - check out [the Jupyter Book documentation][jb-docs] for more information.
2226

2327
* [Examples of Markdown](/markdown)
2428
* [Rendering a notebook Jupyter Notebook](/notebooks)
2529
* [A notebook written in MyST Markdown](/markdown-notebooks)
2630

27-
We have also added some popular features for Jupyter Book that really you shouldn't miss when building your own project:
31+
We have also added some popular features for Jupyter Book that really you shouldn't miss when building your own project with Jupyter Book and Read the Docs:
2832

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)
33+
* [intersphinx to link to other documentation and Jupyter Book projects](/intersphinx)
34+
* [sphinx-examples to show examples and results side-by-side](/sphinx-examples)
3135
* [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)
36+
* [sphinx-proof for logic and math, to write proofs, theorems, lemmas etc.](/sphinx-proof)
3437

35-
## Jupyter Book examples
3638

37-
This is a small sample book to give you a feel for how book content is
38-
structured.
39-
It shows off a few of the major file types, as well as some sample content.
40-
It does not go in-depth into any particular topic - check out [the Jupyter Book documentation][jb-docs] for more information.
39+
## Table of Contents
4140

42-
Check out the content pages bundled with this sample book to see more.
41+
Here is an automatically generated Tabel of Contents:
4342

4443
```{tableofcontents}
4544
```

docs/sphinx-examples.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Examples boxes with sphinx-examples
2+
3+
In this example project, we have enabled the extension `sphinx-examples` in `_config.yml` to be able to display source code alongside its rendered result.
4+
5+
You can use it this way:
6+
7+
```{example} Use examples to show source code and rendered result
8+
```{example} Example title
9+
Here's my **example**!
10+
```
11+

docs/sphinx-proof.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Write proofs with sphinx-proof
2+
3+
Easily render proofs, theorems, axioms, lemmas, definitions and much more with `sphinx-proof`. Read more in the [documentation of sphinx-proof](sphinxproof:syntax).
4+
5+
````{prf:proof}
6+
We'll omit the full proof.
7+
8+
But we will prove sufficiency of the asserted conditions.
9+
10+
To this end, let $y \in \mathbb R^n$ and let $S$ be a linear subspace of $\mathbb R^n$.
11+
12+
Let $\hat y$ be a vector in $\mathbb R^n$ such that $\hat y \in S$ and $y - \hat y \perp S$.
13+
14+
Let $z$ be any other point in $S$ and use the fact that $S$ is a linear subspace to deduce
15+
16+
```{math}
17+
\| y - z \|^2
18+
= \| (y - \hat y) + (\hat y - z) \|^2
19+
= \| y - \hat y \|^2 + \| \hat y - z \|^2
20+
```
21+
22+
Hence $\| y - z \| \geq \| y - \hat y \|$, which completes the proof.
23+
````
24+

0 commit comments

Comments
 (0)