JuliaDocs / JuliaDocs/DocStringExtensions.jl

Default argument value in function documentation

Open
#107 11 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Feature up for grabs
Dominant language
Julia
Stars
126
Forks
35
PR merge metrics
No merged PRs in 30d

Description

Consider the following documentation for a function f1 in a module CGP

"""
$(TYPEDSIGNATURES)
"""
function f1(a::Int, b::Int=0)
    return a + b
end

The generated documentation is
Snipaste_2021-02-05_14-53-00

Two signatures are produced, but information of the default value is lost. I have to document the default value of b manually.

Is it possible to produce a single signature that contains the default value? Something like follows

f1(a::Int64, b::Int64=0) -> Int64

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the documented f1(a::Int, b::Int=0) example in module CGP and inspect how TYPEDSIGNATURES generates its two signatures. Compare the generated output with the requested single signature containing b=0; done means default values are preserved without manual documentation, with existing documentation behavior still working.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.