Skip to content

Commit d34c785

Browse files
janfbmichaeldeistler
authored andcommitted
docs: website building docs
1 parent 4dfd908 commit d34c785

File tree

2 files changed

+55
-26
lines changed

2 files changed

+55
-26
lines changed

docs/README.md

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,45 @@
11
# Documentation
22

3-
The documentation is available at: <http://sbi-dev.github.io/sbi>
3+
The documentation is available at: [sbi-dev.github.io/sbi](http://sbi-dev.github.io/sbi)
44

55
## Building the Documentation
66

7-
You can build the docs locally by running the following command from this subfolder:
7+
We use [`mike`](https://github.com/jimporter/mike) to manage, build, and deploy our
8+
documentation with [`mkdocs`](https://www.mkdocs.org/). To build the documentation
9+
locally, follow these steps:
810

9-
```bash
10-
jupyter nbconvert --to markdown ../tutorials/*.ipynb --output-dir docs/tutorial/
11-
jupyter nbconvert --to markdown ../examples/*.ipynb --output-dir docs/examples/
12-
mkdocs serve
13-
```
11+
1. Install the documentation dependencies:
1412

15-
The docs can be updated to GitHub using:
13+
```bash
14+
python -m pip install .[doc]
15+
```
1616

17-
```bash
18-
jupyter nbconvert --to markdown ../tutorials/*.ipynb --output-dir docs/tutorial/
19-
jupyter nbconvert --to markdown ../examples/*.ipynb --output-dir docs/examples/
20-
mkdocs gh-deploy
21-
```
17+
2. Convert the current version of the documentation notebooks to markdown and build the
18+
website locally using `mike`:
19+
20+
```bash
21+
jupyter nbconvert --to markdown ../tutorials/*.ipynb --output-dir docs/tutorials/
22+
jupyter nbconvert --to markdown ../examples/*.ipynb --output-dir docs/examples/
23+
mike serve
24+
```
25+
26+
### Deployment
27+
28+
Website deployment is managed with `mike` and happens automatically:
29+
30+
- With every push to `main`, a `dev` version of the most recent documentation is built.
31+
- With every new published **release**, the current documentation is deployed on the
32+
website.
33+
34+
Thus, the documentation on the website always refers to the latest release, and not
35+
necessarily to the version on `main`.
2236

2337
## Contributing FAQ
2438

25-
Create a new markdown file named `question_XX.md` in the `docs/faq` folder, where `XX`
26-
is a running index for the questions. The file should start with the question as title
27-
(i.e. starting with a `#`) and then have the answer below. Additionally, you need to
28-
add a link to your question in the markdown file `docs/faq.md`.
39+
We welcome contributions to our list of frequently asked questions. To contribute:
40+
41+
1. Create a new markdown file named `question_XX.md` in the `docs/faq` folder, where
42+
`XX` is a running index for the questions.
43+
2. The file should start with the question as the title (i.e. starting with a `#`) and
44+
then have the answer below.
45+
3. Add a link to your question in the [`docs/faq.md`] file using the same index.

docs/docs/contribute.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,31 @@ fails (xfailed).
211211
commenting on the PR.
212212

213213
## Contributing to the documentation
214-
Most of the documentation for `sbi` is written in markdown and the website is
215-
generated using `mkdocs` with `mkdocstrings`. To work on improvements of the
216-
documentation, you should first install the `doc` dependencies:
217-
```
214+
215+
Most of the documentation for `sbi` is written in markdown and the website is generated
216+
using `mkdocs` with `mkdocstrings` and `mike`. The tutorials and examples are converted
217+
from jupyter notebooks into markdown files to be shown on the website. To work on
218+
improvements of the documentation, you should first install the `doc` dependencies:
219+
220+
```bash
218221
pip install -e ".[doc]"
219222
```
220-
Then, you can run the command on your terminal
223+
224+
Then, you can build the website locally by executing in the `docs` folder
225+
226+
```bash
227+
mike serve
221228
```
229+
230+
This will build the website on a local host address shown in the terminal. Changes to
231+
the website files or a browser refresh will immediately rebuild the website.
232+
233+
If you want to build the latest version of the tutorial notebooks, you need to convert
234+
them to markdown first:
235+
236+
```bash
222237
cd docs
223238
jupyter nbconvert --to markdown ../examples/*.ipynb --output-dir docs/examples/
224239
jupyter nbconvert --to markdown ../tutorials/*.ipynb --output-dir docs/tutorials/
225-
mkdocs serve
240+
mike serve
226241
```
227-
and open a browser on the page proposed by `mkdocs`. Now, whenever you
228-
make changes to the markdown files of the documentation, you can see the results
229-
almost immediately in the browser.

0 commit comments

Comments
 (0)