I need to document several functions that share a good deal of common options/arguments (example here).
To avoid repeating the same definitions in each function, is there a way to put the common text in a ‘place’ and import it in the documentation section of each function?
This is actually what we do with RST version of those docs.
String interpolation should work, so you could just put the shared documentation in a string constant and just interpolate. For example, it even works to read the contents from a file:
julia> write("docstr.md", "# Common documentation...")
25
julia> """
f()
Does a cool thing
$(readstring("docstr.md"))
""" f() = "My cool function"
f
help?> f
search: fd for fma fld fft full fld1 find filt fill fft! fdio frexp foldr foldl flush floor float first findn filt! fill! fetch FFTW fldmod findnz findin filter falses finally foreach flipdim
f()
Does a cool thing
Common documentation...
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡