Documenter: preprocess ?foo to [`foo`](@ref).. possible?

In my docstrings I often use "See ?foo for details".
With Documenter, for most sinks this would be better as "See [`foo`](@ref) for details."

But that would then look odd if one use the online help of the original function.

Is there any option to preprocess and transform any ?foo to [`foo`](@ref) ?

1 Like
repl = r"\?(\w+)" => s"[`\1`](@ref)"
for file in files
    write(f, replace(read(file, String), repl))
1 Like

Sorry, I thought there could have been a built-in solution. I realised we go back to this discussion about adding a callback (and this pull request) to custom preprocess the documentation source.

In that case, I ended up implementing it by using temporary files/directories in the make.jl file, but a simple custom function string preprocessing would be much simpler both to implement (that pull request was just 12 line changes) and to use (I have no idea how to implement it at the AST level as suggested by @mortenpi , it seems much more complex…)…

You should be able to do [`?foo`](@ref foo).