Skip to content

Commit ca7676a

Browse files
OriolAbrilAlexAndorra
authored andcommitted
change rendering to fit into page
1 parent fd227e3 commit ca7676a

File tree

1 file changed

+58
-38
lines changed

1 file changed

+58
-38
lines changed

docs/source/contributing/jupyter_style.md

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -31,58 +31,78 @@ Using MyST allows taking advantage of all sphinx features from markdown cells in
3131
All markdown should be valid MyST (note that MyST is a superset of recommonmark).
3232
This guide does not teach nor cover MyST extensively, only gives some opinionated guidelines.
3333

34-
* **Never** use url links to refer to other notebooks, PyMC documentation or other python
35-
libraries documentations. Use [sphinx cross-references](https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html)
36-
instead.
37-
38-
* For instance, to link to another notebook, you could use an explicit link in the markdown text: "this model uses the \{ref}`Kronecker product <GP-Kron>`". See {ref}`this page <myst:syntax/targets>` for more details.
34+
* **Never** use url links to refer to other notebooks, PyMC documentation or other python libraries documentations.
35+
When linking to other notebooks, always use a `ref` type cross-reference pointing to the target in the {ref}`jupyter_style_first_cell`.
3936

4037
:::{caution}
4138
Using urls links breaks self referencing in versioned docs! And at the same time they are
4239
less robust than sphinx cross-references.
4340
:::
4441

45-
* When linking to other notebooks, always use a `ref` type cross-reference pointing
46-
to the target in the {ref}`jupyter_style_first_cell`.
42+
::::{dropdown} Examples of cross-references
4743

48-
* Here are more guidances on reference links:
44+
**References to targets within the current project**
4945

50-
#### References to targets within the current project
51-
That is, notebooks in pymc-examples referring to other notebooks in pymc-examples.
46+
That is, notebooks in pymc-examples referring to other notebooks in pymc-examples.
5247

53-
```
54-
{ref}`explicit text <anchor_id>`
55-
```
56-
For instance:
57-
```
58-
{ref}`Kronecker product <GP-Kron>`
59-
```
48+
Pattern:
49+
```
50+
{ref}`explicit text <anchor_id>`
51+
```
52+
53+
Example source:
54+
```
55+
{ref}`Kronecker product <GP-Kron>`
56+
```
6057

61-
#### References to targets of other projects
62-
These can be to any project defined in the [intersphinx mapping](https://github.com/pymc-devs/pymc/blob/main/docs/source/conf.py#L300-L312). For example, from pymc-examples to pymc main docs, or to arviz docs or to matplotlib docs; it doesn't matter when it comes to syntax.
58+
Rendered example: {ref}`Kronecker product <GP-Kron>`
6359

64-
```
65-
{ref}`explicit text <key:anchor_id>`
66-
```
67-
where key is one of the keys defined in the [intersphinx mapping](https://github.com/pymc-devs/pymc/blob/main/docs/source/conf.py#L300-L312), such as `pymc`, `arviz`, `numpy`...
68-
For instance:
69-
```
70-
{ref}`ArviZ `plot_hdi` <arviz:plot_hdi>`
71-
```
60+
**References to targets of other projects**
7261

73-
#### References to python objects
62+
Here "other projects" means any sphinx documentation site that was build independently
63+
of the current one. Therefore, this includes linking to pymc-examples notebooks
64+
from the pymc documentation or vice versa, or linking to other libraries like
65+
arviz, numpy, matplotlib...
7466

75-
```
76-
{type}`import.path` # to show full import path
77-
{type}`~import.path` # to show only object name
78-
```
79-
where type is func for functions, meth for methods, class for classes, prop for property, etc.
80-
For instance:
81-
```
82-
{class}`~pymc.gp.HSGP`
83-
```
67+
Pattern:
68+
```
69+
{ref}`explicit text <key:anchor_id>`
70+
```
71+
Example source:
72+
```
73+
{ref}`how to use InferenceData <arviz:working_with_InferenceData>`
74+
```
75+
76+
Rendered example: {ref}`how to use InferenceData <arviz:working_with_InferenceData>`
77+
78+
where `key` in the pattern (`arviz` in the example) is one of the keys defined in
79+
the `intersphinx_mapping` variable of `conf.py` such as `arviz`, `numpy`, `mpl`...
80+
For the main pymc repo it is located in `docs/source/conf.py`, for pymc-examples it is
81+
in `examples/conf.py`.
82+
83+
**References to python objects**
84+
85+
Pattern
86+
```
87+
{type}`import.path` # to show full import path
88+
{type}`~import.path` # to show only object name
89+
```
90+
where type is func for functions, meth for methods, class for classes, prop for property, etc.
91+
92+
Example source:
93+
```
94+
{class}`~pymc.gp.HSGP`
95+
```
96+
97+
Rendered example: {class}`~pymc.gp.HSGP`
98+
99+
100+
:::{seealso}
101+
* [ReadTheDocs page on sphinx cross-references](https://docs.readthedocs.io/en/stable/guides/cross-referencing-with-sphinx.html) instead.
102+
* {ref}`MyST docs on cross-references <myst:syntax/referencing>`.
103+
:::
104+
::::
84105

85-
Now let's continue with the MysT guidelines.
86106

87107
* If the output (or even code and output) of a cell is not necessary to follow the
88108
notebook or it is very long and can break the flow of reading, consider hiding

0 commit comments

Comments
 (0)