3
3
Julia enables package developers and users to document functions, types and other objects easily
4
4
via a built-in documentation system since Julia 0.4.
5
5
6
- The basic syntax is simple: any string appearing at the top-level right before an object
7
- (function, macro, type or instance) will be interpreted as documenting it (these are called * docstrings * ).
8
- Note that no blank lines or comments may intervene between a docstring and the documented object.
9
- Here is a basic example:
6
+ The basic syntax is simple: any string appearing at the toplevel right before an object
7
+ (function, macro, type or instance) will be interpreted as documenting it (these are called
8
+ * docstrings * ). Note that no blank lines or comments may intervene between a docstring and
9
+ the documented object. Here is a basic example:
10
10
11
11
``` julia
12
12
" Tell whether there are too foo items in the array."
@@ -187,16 +187,16 @@ As in the example above, we recommend following some simple conventions when wri
187
187
f (x, y) = ...
188
188
```
189
189
190
- This makes it more clear where docstrings start and end.
190
+ This makes it clearer where docstrings start and end.
191
191
9 . Respect the line length limit used in the surrounding code.
192
192
193
193
Docstrings are edited using the same tools as code. Therefore, the same conventions should apply.
194
- It is advised to add line breaks after 92 characters.
194
+ It is recommended that lines are at most 92 characters wide .
195
195
6 . Provide information allowing custom types to implement the function in an
196
- ` # Implementation ` section. These implementation details intended for developers
197
- rather than users, explaining e.g. which functions should be overridden and which functions
198
- automatically use appropriate fallbacks, are better kept separate from the main description of
199
- the function's behavior.
196
+ ` # Implementation ` section. These implementation details are intended for developers
197
+ rather than users, explaining e.g. which functions should be overridden and which
198
+ functions automatically use appropriate fallbacks. Such details are best kept separate
199
+ from the main description of the function's behavior.
200
200
201
201
## Accessing Documentation
202
202
@@ -209,8 +209,9 @@ by typing `?` followed by the name of a function or macro, and pressing `Enter`.
209
209
?r" "
210
210
```
211
211
212
- will bring up docs for the relevant function, macro or string macro respectively. In [ Juno] ( http://junolab.org )
213
- using ` Ctrl-J, Ctrl-D ` will bring up documentation for the object under the cursor.
212
+ will show documentation for the relevant function, macro or string macro respectively. In
213
+ [ Juno] ( http://junolab.org ) using ` Ctrl-J, Ctrl-D ` will show the documentation for the object
214
+ under the cursor.
214
215
215
216
## Functions & Methods
216
217
@@ -335,6 +336,7 @@ y = MyType("y")
335
336
## Syntax Guide
336
337
337
338
A comprehensive overview of all documentable Julia syntax.
339
+
338
340
In the following examples ` "..." ` is used to illustrate an arbitrary docstring.
339
341
340
342
### ` $ ` and ` \ ` characters
@@ -520,8 +522,8 @@ the referenced value itself.
520
522
sym
521
523
```
522
524
523
- Adds docstring ` "..." ` to the value associated with ` sym ` . Users should prefer documenting ` sym `
524
- at its definition .
525
+ Adds docstring ` "..." ` to the value associated with ` sym ` . However, it is preferred that
526
+ ` sym ` is documented where it is defined .
525
527
526
528
### Multiple Objects
527
529
@@ -551,9 +553,9 @@ two functions are related, such as non-mutating and mutating versions `f` and `f
551
553
@m expression
552
554
```
553
555
554
- Adds docstring ` "..." ` to expression generated by expanding ` @m expression ` . This allows for expressions
555
- decorated with ` @inline ` , ` @noinline ` , ` @generated ` , or any other macro to be documented in the
556
- same way as undecorated expressions.
556
+ Adds docstring ` "..." ` to the expression generated by expanding ` @m expression ` . This allows
557
+ for expressions decorated with ` @inline ` , ` @noinline ` , ` @generated ` , or any other macro to
558
+ be documented in the same way as undecorated expressions.
557
559
558
560
Macro authors should take note that only macros that generate a single expression will automatically
559
561
support docstrings. If a macro returns a block containing multiple subexpressions then the subexpression
0 commit comments