Cross-reference functions from another submodule in Documenter.jl

Given the hierarchy of modules, e.g.

module A module B; function foo end; end module C """ bar(x) Like ['foo'](@ref), but more 'bar'. """ function bar end end end 

How can I cross reference foo from the documentation string of bar using Documenter.jl ? I tried ABfoo , B.foo and ..B.foo avail.

+10
source share
1 answer

Firstly, B.foo and C.bar should (i) have documentation lines and (ii) be in the markdown file, for example, in the @docs Documentator @docs .

 '''@docs ABfoo ACbar ''' 

for cross reference between them. Secondly, the B.foo binding should be visible inside the C module. This can be achieved, for example, by adding import ..B: foo to the C module (or by adding export foo to B and using ..B to 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 
+7
source

Source: https://habr.com/ru/post/1264552/


All Articles