Display docstring for extension method in documentation

What should I do I want to document a method defined in an extension? Of course I wrote a docstring but said docstring isn’t displayed in the Documenter.jl build, even when I load the conditional dependencies before loading my package in docs/make.jl. Has anyone faced that issue?

1 Like

Does Issues with package extensions · Issue #2124 · JuliaDocs/Documenter.jl · GitHub help?

1 Like

Yes indeed, it’s a bit ugly but it works :slight_smile:

Sorry to revive this, but the solution in the issue does not seem to be helping here.

My situation is the following: I have a custom type in my package, ContactMap, and in ext/Plotting.jl I define a method to produce a heatmap for that type:

import Plots: heatmap
"""
    heatmap(::ContactMap)

# etc

"""
function heatmap(::ContactMap) end

I’m trying to include this docstring in the manual, with:

```@docs
heatmap(::ContactMap) 
```#

but that’s not working:

  No Changes to `~/.julia/dev/PDBTools/docs/Manifest.toml`
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
┌ Error: no docs found for '!!! warning "Missing docstring."
│ 
│     Missing docstring for `heatmap(::ContactMap)`. Check Documenter's build log for details.' in `@docs` block in src/contacts.md:6-11
│ ```@docs
│ ContactMap
│ contact_map
│ heatmap(::ContactMap)
│ residue_residue_distance
│ 

Should that work, according to the issue mentioned above? Or is it a different situation?

I’m loading both Plots and my package in docs/make.jl.

Do you load the extension too? Among the modules argument to makedocs

How does one do that? Or, more generally, how can I load the extension without loading Plots altogether?

ok, this is what that means in this context:

    modules = [
        MyPackage, 
        isdefined(Base, :get_extension) ? Base.get_extension(MyPackage, :Plotting) : PDBTools.Plotting
    ],
1 Like