Documenting Julia functions and their arguments and keywords.
import Pkg; Pkg.add("DocumentFunction")
import DocumentFunction
julia> print(DocumentFunction.documentfunction(DocumentFunction.documentfunction))
Methods:
- `DocumentFunction.documentfunction(f::Function; location, maintext, argtext, keytext)` : `C:\Users\monty\.julia\dev\DocumentFunction\src\DocumentFunction.jl:26`
Arguments:
- `f` :: `Function` : F
Keywords:
- `location` : Location
- `maintext` : Maintext
- `argtext` : Argtext
- `keytext` : Keytext
julia> print(DocumentFunction.documentfunction(occursin))
Methods:
- `Base.occursin(delim::UInt8, buf::Base.GenericIOBuffer)` : `iobuffer.jl:574`
- `Base.occursin(delim::UInt8, buf::IOBuffer)` : `iobuffer.jl:568`
- `Base.occursin(haystack)` : `strings\search.jl:724`
- `Base.occursin(needle::Union{AbstractChar, AbstractString}, haystack::AbstractString)` : `strings\search.jl:699`
- `Base.occursin(r::Regex, s::AbstractString; offset)` : `regex.jl:292`
- `Base.occursin(r::Regex, s::SubString{String}; offset)` : `regex.jl:297`
Arguments:
- `delim` :: `UInt8` : Delim
- `buf` :: `Base.GenericIOBuffer` : Buf
- `buf` :: `IOBuffer` : Buf
- `haystack` :: `Any` : Haystack
- `needle` :: `Union{AbstractChar, AbstractString}` : Needle
- `haystack` :: `AbstractString` : Haystack
- `r` :: `Regex` : R
- `s` :: `AbstractString` : S
- `s` :: `SubString{String}` : S
Keywords:
- `offset` : Offset
import DocumentFunction
function foobar(f::Function)
return nothing
end
function foobar(f::Function, m::Vector{String}; key1::Bool, key2::String)
return nothing
end
@doc """
$(DocumentFunction.documentfunction(foobar;
location=false,
maintext="Foobar function to do amazing stuff!",
argtext=Dict("f"=>"Input function ...",
"m"=>"Input string array ..."),
keytext=Dict("key1"=>"Key 1 ...",
"key2"=>"Key 2 ...")))
""" foobar
To get help for this new function, type ?foobar
.
This will produce the following output:
Main.foobar
Foobar function to do amazing stuff!
Methods:
• Main.foobar(f::Function)
• Main.foobar(f::Function, m::Vector{String}; key1, key2)
Arguments:
• f :: Function : Input function ...
• m :: Vector{String} : Input string array ...
Keywords:
• key1 : Key1
• key2 : Key2
- MADS (function documentation is produced using DocumentFunction: https://madsjulia.github.io/Mads.jl/Modules/Mads)
- SmartTensors