Include documentation from another file?


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("", "# Common documentation...")

julia> """

       Does a cool thing

       """ f() = "My cool function"

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


  Does a cool thing

     Common documentation...


Wow, that’s really a cool thing. Thanks