Docile is a Julia package documentation system that provides a docstring macro, @doc, for documenting arbitrary Julia objects and associating metadata with them.


The package is in METADATA and can be installed via Pkg.add("Docile").


The @doc macro can be used to document functions, globals, macros, methods, modules, and types. The following example illustrates some basic usage of the macro.

module PackageName

using Docile

@doc " ... " ->
function f(x)
    # ...

@doc """
""" ->
g(x) = x



The Docile package is loaded with using Docile and the current module's documentation is initialised via the @docstrings macro.

The @doc macro is then be used to attach documentation to the methods f(x) and g(x).

Note that the -> is required between the string and the object being documented and it must appear on the same line as the closing ".

A more in-depth discussion covering metadata, formatted docstrings, and documenting generic functions can be found in the entry for @doc.

Backwards compatibility with julia 0.4's @doc

Julia 0.4 includes a documentation system whose design was based on Docile. If you want to leverage the built-in mechanism on julia 0.4, change the

using Docile


if VERSION < v"0.4.0-dev"
    using Docile

Note that some Docile features, like @doc+, are not present in julia 0.4.

Loading Documented Modules

Docile is designed to document whole packages rather than individual source files. This means that calling include("mymodule.jl") where "mymodule.jl" contains:

module MyModule

# ...


will not pickup any of MyModule's docstrings.

The solution is to either make the file "mymodule.jl" into a proper Julia package using Pkg.generate so that using MyModule works, or use require instead of include when loading the file.