Types

The examples show these abbreviations in docstrings, with the source they render from.

DocStringExtensions.TYPEDEF — Constant

An Abbreviation that prints the header of a type definition: struct, mutable struct, abstract type or primitive type, then the unqualified name, the type parameters, and the supertype unless it is Any. A primitive type also shows its size in bits.

Examples

julia> """
       $(TYPEDEF)
       A point in the plane.
       """
       struct Point{T<:Real} <: Number
           x::T
           y::T
       end

julia> @doc Point
  struct Point{T<:Real} <: Number

  A point in the plane.
Note

The fields are not printed. Use FIELDS or TYPEDFIELDS for those.

source
DocStringExtensions.FIELDS — Constant

An Abbreviation that lists the fields of a type, with the docstring of each field that has one. A field given a default value, as Base.@kwdef allows, shows that default.

Examples

julia> """
       A point in the plane.
       $(FIELDS)
       """
       Base.@kwdef struct Point
           "Horizontal coordinate."
           x::Float64
           "Vertical coordinate."
           y::Float64
           label::String = "origin"
       end;

julia> @doc Point
  A point in the plane.

    •  x: Horizontal coordinate.

    •  y: Vertical coordinate.

    •  label = "origin"
Hiding Default Values

To leave out default values, use $(DocStringExtensions.TypeFields(defaults = false)).

source
DocStringExtensions.TYPEDFIELDS — Constant

An Abbreviation that lists the fields of a type like FIELDS, with the type of each field.

Examples

julia> """
       A point in the plane.
       $(TYPEDFIELDS)
       """
       struct Point
           "Horizontal coordinate."
           x::Float64
           "Vertical coordinate."
           y::Float64
           label::String
       end

julia> @doc Point
  A point in the plane.

    •  x::Float64: Horizontal coordinate.

    •  y::Float64: Vertical coordinate.

    •  label::String
Hiding Default Values

To leave out default values, use $(DocStringExtensions.TypeFields(types = true, defaults = false)).

source
DocStringExtensions.SUBTYPES — Constant

An Abbreviation that lists the direct subtypes of a type as Documenter.jl @ref links. It prints nothing for other objects.

Examples

julia> """
       A shape.
       $(SUBTYPES)
       """
       abstract type Shape end

julia> struct Circle <: Shape end

julia> struct Square <: Shape end

julia> @doc Shape
  A shape.

    •  Circle
    •  Square
Note

Only subtypes defined in the type's own module, or in a module inside it, are listed, so a subtype another package defines is left out. A subtype in an inner module is qualified with that module's name.

source

Options

DocStringExtensions.TypeFields — Type
TypeFields(; types, defaults)

The abbreviation behind FIELDS and TYPEDFIELDS. types = true prints the type of each field, as TYPEDFIELDS does. defaults = false leaves out the default values. By default types = false and defaults = true, as in FIELDS.

source