blupp
blupp

Reputation: 337

Combine default and custom docstrings in julia 1.1.0?

I'm using Julia v1.1.0 and have a question about writing documentation (docstrings).

I find the default documentation of constructors very useful, especially the listing of fields. Is there a way to combine default documentation with custom documentation, so that I get both an automatic listing of field names and a manually written docstring?

Upvotes: 2

Views: 186

Answers (1)

fredrikekre
fredrikekre

Reputation: 10984

You might be interested in the package DocStringExtensions (documentation), in particular the FIELDS abbreviation. Example:

julia> using DocStringExtensions

julia> """
       This is some documentation.

       $(FIELDS)
       """
       struct Struct
           x
           "docs for field y"
           y
       end
Struct

help?> Struct
search: Struct struct isstructtype mutable struct unsafe_trunc

  This is some documentation.

    •    x

    •    y

        docs for field y

Upvotes: 2

Related Questions