# Docstrings from package extensions in Documenter.jl

**URL:** <https://discourse.julialang.org/t/docstrings-from-package-extensions-in-documenter-jl/104690>\
**Category:** General Usage\
**Created:** [October 7, 2023, 6:26am UTC](https://discourse.julialang.org/t/docstrings-from-package-extensions-in-documenter-jl/104690 "2023-10-07T06:26:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![April-Hannah-Lena](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/april-hannah-lena/32/38975_2.png) [@April-Hannah-Lena](https://discourse.julialang.org/u/April-Hannah-Lena)\
**Post date:** [October 7, 2023, 6:26am UTC](https://discourse.julialang.org/t/docstrings-from-package-extensions-in-documenter-jl/104690/1 "2023-10-07T06:26:27Z")

</div>

Say I have a package `MyPackage`

```julia
module MyPackage

"""
Standard behavior.
"""
function do_something(x::Vector)
    x .^ 3
end

end # module

```

with a `CUDA` extension:

```julia
module CUDAExt

import MyPackage: do_something

"""
Special CUDA behavior with such-and-such extra info for usage
"""
function do_something(x::CuVector)
    x .^ 3
end

end # module

```

Obviously, I now want a page in my docs explaining the extra info regarding CUDA, including the CUDA-specific docstring. Is there an accepted way to do this?

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [October 7, 2023, 9:35am UTC](https://discourse.julialang.org/t/docstrings-from-package-extensions-in-documenter-jl/104690/2 "2023-10-07T09:35:41Z")

</div>

In the “standard” docstring. Include a discussion like “If CUDA is loaded…”

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [October 7, 2023, 9:43am UTC](https://discourse.julialang.org/t/docstrings-from-package-extensions-in-documenter-jl/104690/3 "2023-10-07T09:43:28Z")

</div>

You can load the extensions in the docs as well (we tried to even make it safe for earlier Julia versions here I think) see

> <https://github.com/JuliaManifolds/Manifolds.jl/blob/71cd2aa54591ee35cdbb45af9c810c5c3704e60c/docs/make.jl#L72-L90>

That way all function definitions (and their docs) from the extension should be loaded when rendering the docs, so you can add them.

But as Michael wrote – a remark in the “standard docstring” is probably also a good idea.
