# Include documentation from another file?

**URL:** <https://discourse.julialang.org/t/include-documentation-from-another-file/6367>\
**Category:** General Usage\
**Created:** [October 9, 2017, 10:59pm UTC](https://discourse.julialang.org/t/include-documentation-from-another-file/6367 "2017-10-09T22:59:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 9, 2017, 10:59pm UTC](https://discourse.julialang.org/t/include-documentation-from-another-file/6367/1 "2017-10-09T22:59:55Z")

</div>

I need to document several functions that share a good deal of common options/arguments ([example here](https://genericmappingtools.github.io/GMT.jl/latest/)).

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.

---

<div class="post-metadata">

**Author:** ![jmert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmert/32/3161_2.png) [@jmert](https://discourse.julialang.org/u/jmert)\
**Post date:** [October 9, 2017, 11:21pm UTC](https://discourse.julialang.org/t/include-documentation-from-another-file/6367/2 "2017-10-09T23:21:24Z")

</div>

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:

```nohighlight
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...
    ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

```

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [October 9, 2017, 11:36pm UTC](https://discourse.julialang.org/t/include-documentation-from-another-file/6367/3 "2017-10-09T23:36:13Z")

</div>

Wow, that’s really `a cool thing`. Thanks
