Given a module hierarchy like
module A
module B; function foo end; end
module C
"""
bar(x)
Like [`foo`](@ref), but more `bar`.
"""
function bar end
end
end
How could I cross-reference foo
from the docstring of bar
using Documenter.jl? I have tried A.B.foo
, B.foo
, and ..B.foo
without success.
First, both B.foo
and C.bar
needs to (i) have docstrings and (ii) be in the markdown file, e.g. in a Documenter @docs
block.
```@docs
A.B.foo
A.C.bar
```
in order to cross-reference between them. Second, the binding B.foo
must be visible inside the C
module. This can be achieved by, for example, adding import ..B: foo
in the C
module (or adding export foo
in B
and using ..B
in C
). Here is a working example:
module A
module B
"foo function"
function foo end
end
module C
import ..B: foo
"""
bar(x)
Like [`foo`](@ref), but more `bar`.
"""
function bar end
end
end # module
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With