You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/contributing/jupyter_style.md
+58-38Lines changed: 58 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -31,58 +31,78 @@ Using MyST allows taking advantage of all sphinx features from markdown cells in
31
31
All markdown should be valid MyST (note that MyST is a superset of recommonmark).
32
32
This guide does not teach nor cover MyST extensively, only gives some opinionated guidelines.
33
33
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`.
39
36
40
37
:::{caution}
41
38
Using urls links breaks self referencing in versioned docs! And at the same time they are
42
39
less robust than sphinx cross-references.
43
40
:::
44
41
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
47
43
48
-
* Here are more guidances on reference links:
44
+
**References to targets within the current project**
49
45
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.
52
47
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
+
```
60
57
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.
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**
72
61
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...
74
66
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
+
::::
84
105
85
-
Now let's continue with the MysT guidelines.
86
106
87
107
* If the output (or even code and output) of a cell is not necessary to follow the
88
108
notebook or it is very long and can break the flow of reading, consider hiding
0 commit comments