Skip to content

Commit

Permalink
Describe how to document non-toplevel code
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
MichaelHatherly committed Sep 14, 2015
1 parent 73d99f4 commit fa7bdb1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions doc/manual/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,27 @@ Or for use with Julia's metaprogramming functionality:
@doc "`add(a,b)` adds `a` and `b` together" add
@doc "`subtract(a,b)` subtracts `b` from `a`" subtract
Documentation written in non-toplevel blocks, such as ``if``, ``for``, and ``let``, are not
automatically added to the documentation system. ``@doc`` must be used in these cases. For
example:

.. code-block:: julia
if VERSION > v"0.4"
"..."
f(x) = x
end
will not add any documentation to ``f`` even when the condition is ``true`` and must instead
be written as:

.. code-block:: julia
if VERSION > v"0.4"
@doc "..." ->
f(x) = x
end
Syntax Guide
------------

Expand Down

0 comments on commit fa7bdb1

Please sign in to comment.