Showcase

This page shows how the various abbreviations look. The docstrings themselves can be found in docs/Showcase/src/Showcase.jl.

Modules

Showcase.ShowcaseModule

This docstring is attached to the Showcase module itself.

The EXPORTS abbreviation creates a bulleted list of all the exported names:

Similarly, the IMPORTS abbreviation lists all the imported modules:

  • Base
  • Core
  • DocStringExtensions

The README can be used to include the README.md file in a docstring. The content between the horizontal lines is spliced by the abbreviation:


Showcase.jl

The demo library for DocStringExtensions.


The LICENSE abbreviation can be used in the same way for the LICENSE.md file.

source

Functions and methods

Showcase.fooMethod

This docstring is attached to a method that uses default values for some positional arguments: foo(x::Int, y=3).

As this effectively means that there are two different methods taking different numbers of arguments, the SIGNATURES abbreviation produces the following result:

foo(x)
foo(x, y)

The TYPEDSIGNATURES abbreviation can be used to also get the types of the variables in the function signature:

foo(x::Int64)
foo(x::Int64, y)

The FUNCTIONNAME abbreviation can be used to directly include the name of the function in the docstring (e.g. here: foo). This can be useful when writing your own type signatures:

foo(x, ...)
source

Type parameters

TYPEDSIGNATURES can also handle type parameters. However, the resulting signatures may not be as clean as in the code since they have to be reconstructed from Julia's internal representation:

Showcase.barMethod

A method for bar, with type parameters. Original declaration:

bar(x::AbstractArray{T}, y::T) where {T <: Integer} = nothing

And the result from TYPEDSIGNATURES abbreviation:

bar(x::AbstractArray{T<:Integer, N} where N, y::Integer)

For comparison, SIGNATURES abbreviation:

bar(x, y)
source
Showcase.barMethod

A method for bar, with type parameters. Original declaration:

bar(x::AbstractArray{T}, ::String) where {T <: Integer} = x

And the result from TYPEDSIGNATURES abbreviation:

bar(
    x::AbstractArray{T<:Integer, N} where N,
    _::String
) -> AbstractArray{T, N} where {T<:Integer, N}

For comparison, SIGNATURES abbreviation:

bar(x, _)
source
Showcase.barMethod

A method for bar, with type parameters. Original declaration:

bar(x::AbstractArray{T}, y::U) where {T <: Integer, U <: AbstractString} = 0

And the result from TYPEDSIGNATURES abbreviation:

bar(
    x::AbstractArray{T<:Integer, N} where N,
    y::AbstractString
) -> AbstractArray{T, N} where {T<:Integer, N}

For comparison, SIGNATURES abbreviation:

bar(x, y)
source

Types

Showcase.FoobarType

The TYPEDEF abbreviation includes the type signature:

struct Foobar{T<:AbstractString}

The FIELDS abbreviation creates a list of all the fields of the type. If the fields has a docstring attached, that will also get included.

  • x: Docstring for the x field.

  • y

  • z: Docstring for the z field.


TYPEDFIELDS also adds in types for the fields:

  • x::Nothing: Docstring for the x field.

  • y::AbstractString

  • z::Vector{T} where T<:AbstractString: Docstring for the z field.

source