Skip to content

Commit 4ac5ed2

Browse files
authored
Mention docstrings in the style guide (#57580)
Mention docstrings in the style guide and link to the section of the manual that gives more detail.
1 parent 6817691 commit 4ac5ed2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

doc/src/manual/documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ environments provide a way to access documentation directly:
2323
`Docs.hasdoc(module, name)::Bool` tells whether a name has a docstring. `Docs.undocumented_names(module; all)`
2424
returns the undocumented names in a module.
2525

26-
## Writing Documentation
26+
## [Writing Documentation](@id man-writing-documentation)
2727

2828
Julia enables package developers and users to document functions, types and other objects easily
2929
via a built-in documentation system.

doc/src/manual/style-guide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ Julia's compiler works.
1919
It is also worth emphasizing that functions should take arguments, instead of operating directly
2020
on global variables (aside from constants like [`pi`](@ref)).
2121

22+
## Write docstrings
23+
24+
Comments describing an object should typically be written as [docstrings](@ref man-writing-documentation) for editor and REPL accessibility.
25+
Inline comments (`# comment`) and multiline comments (`#= comment =#`) are appropriate for information that is intended only for the reader of the code (as opposed to a user).
26+
2227
## Avoid writing overly-specific types
2328

2429
Code should be as generic as possible. Instead of writing:

0 commit comments

Comments
 (0)