DocStringExtensions
DocStringExtensions — Module
Extensions for the Julia docsystem.
DocStringExtensions generates parts of a docstring from the code it documents, so the docstring stays in step with the code. You interpolate an abbreviation into a docstring, and it expands to Markdown when the docstring is first shown, in the REPL's ? mode or in Documenter.jl. Abbreviations cover method signatures and method lists, struct fields and subtypes, enum instances, and module exports. @template adds abbreviations to every docstring of a given kind in a module.
Examples
When the docstring is shown, $(SIGNATURES) is replaced by the signature:
julia> using DocStringExtensions
julia> """
A short summary of `func`.
$(SIGNATURES)
where `x` and `y` should both be positive.
"""
func(x, y) = x + y;
julia> @doc func
A short summary of func.
func(x, y)
where x and y should both be positive.Argument names written into the text by hand, such as x and y above, are not updated.
Exports
To start using the package, see Setup. To write an abbreviation of your own, see Custom abbreviations.
Abbreviations
| Abbreviation | Examples | Reference |
|---|---|---|
SIGNATURES, TYPEDSIGNATURES, FUNCTIONNAME, BODY | Functions and methods | Functions and methods |
METHODLIST, TYPEDMETHODLIST | Functions and methods | Functions and methods |
TYPEDEF, FIELDS, TYPEDFIELDS, SUBTYPES | Types | Types |
INSTANCES | Enums | Enums |
EXPORTS, PUBLIC, IMPORTS, README, LICENSE | Modules | Modules |
@template, DOCSTRING, NOTEMPLATE | Templates | Templates |