Documenter.jl: @ref a specific method of a function

时间:2018-02-03 09:45:14

标签: julia

Let's say I have two methods

"""
    f(x::Integer)

Integer version of `f`.
"""
f(x::Integer) = println("I'm an integer!")

"""
    f(x::Float64)

Float64 version of `f`.
"""
f(x::Float64) = println("I'm floating!")

and produce doc entries for those methods in my documentation using Documenter.jl's @autodocs or @docs.

How can I refer (with @ref) to one of the methods?

I'm searching for something like [integer version](@ref f(::Integer)) (which unfortunately does not work) rather than just [function f](@ref f) or [f](@ref).

Note that for generating the doc entries @docs has a similar feature. From the guide page:

[...] include the type in the signature with

```@docs
length(::T)
```

Thanks in advance.

x-ref: https://discourse.julialang.org/t/documenter-jl-ref-a-specific-method-of-a-function/8792

x-ref: https://github.com/JuliaDocs/Documenter.jl/issues/569#issuecomment-362760811

1 个答案:

答案 0 :(得分:0)

正如@mortenpi在Discourse和github上指出的那样:

  

您通常会引用名为[`f`](@ref)的函数   在文本部分的反引号之间引用的函数   链接。然后,您还可以参考特定的签名,例如同   [`f(::Integer)`](@ref)

     

应更新文档中的@ref部分以提及此内容   可能性。