Showcase
This page shows how the various abbreviations look. The docstrings themselves can be found in docs/Showcase/src/Showcase.jl
.
Modules
Showcase.Showcase
— ModuleThis 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.
Functions and methods
Showcase.foo
— FunctionThis docstring is attached to an empty function definitions. The METHODLIST
abbreviation allows you to list all the methods though:
foo(x)
foo(x, y)
defined at /home/runner/work/DocStringExtensions.jl/DocStringExtensions.jl/docs/Showcase/src/Showcase.jl:59
.
foo(x)
defined at /home/runner/work/DocStringExtensions.jl/DocStringExtensions.jl/docs/Showcase/src/Showcase.jl:70
.
Showcase.foo
— MethodThis 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, ...)
Showcase.foo
— MethodA different method for foo
. SIGNATURES
abbreviation:
foo(x)
And the TYPEDSIGNATURES
abbreviation:
foo(x::AbstractString)
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.bar
— MethodA 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)
Showcase.bar
— MethodA 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, _)
Showcase.bar
— MethodA 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)
Types
Showcase.Foobar
— TypeThe 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 thex
field.y
z
: Docstring for thez
field.
TYPEDFIELDS
also adds in types for the fields:
x::Nothing
: Docstring for thex
field.y::AbstractString
z::Vector{T} where T<:AbstractString
: Docstring for thez
field.