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

source

To start using the package, see Setup. To write an abbreviation of your own, see Custom abbreviations.

Abbreviations

AbbreviationExamplesReference
SIGNATURES, TYPEDSIGNATURES, FUNCTIONNAME, BODYFunctions and methodsFunctions and methods
METHODLIST, TYPEDMETHODLISTFunctions and methodsFunctions and methods
TYPEDEF, FIELDS, TYPEDFIELDS, SUBTYPESTypesTypes
INSTANCESEnumsEnums
EXPORTS, PUBLIC, IMPORTS, README, LICENSEModulesModules
@template, DOCSTRING, NOTEMPLATETemplatesTemplates