File tree 1 file changed +20
-5
lines changed
1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -99,14 +99,29 @@ documentation:
99
99
...
100
100
"""
101
101
102
- 5. Group examples under an ``# Examples `` section and use ````julia `` blocks instead of
102
+ 5. Group examples under an ``# Examples `` section and use ````` julia `` blocks instead of
103
103
standard text.
104
104
105
105
Examples should consist of verbatim copies of the Julia REPL, including the ``julia> ``
106
- prompt (see example above). This will be used in the future to allow running examples
107
- automatically and checking that their actual output is consistent with that presented
108
- in the documentation (a feature called *doctests *). This way, the code will be tested and
109
- examples won't get out of date without notice.
106
+ prompt (see example above). This is used to allow running examples automatically and
107
+ checking that their actual output is consistent with that presented in the
108
+ documentation (a feature called *doctests *). This way, the code will be tested and
109
+ examples won't get out of date without notice. An example::
110
+
111
+ """
112
+ Some nice documentation here.
113
+
114
+ ```jldoctest
115
+ julia> a = [1 2; 3 4]
116
+ 2×2 Array{Int64,2}:
117
+ 1 2
118
+ 3 4
119
+ ```
120
+ """
121
+
122
+ You can then run ``make -C doc doctest `` to run all the doctests, which will ensure
123
+ that your example works. Note that whitespace in your doctest is significant! The
124
+ doctest will fail if you misalign the output of pretty-printing an array, for example.
110
125
111
126
6. Use backticks to identify code and equations.
112
127
You can’t perform that action at this time.
0 commit comments