I am trying to create a documentation for a Julia module using Documenter.jl
. Now I imported a module which documenter cannot find for some reason. More explicitly: I imported SparseArrays.jl
via import SparseArrays
and am referencing SparseArrays.AbstractSparseArray
in a docstring. (I also have SparseArrays.jl
installed.) Yet I get ERROR: LoadError: UndefVarError: SparseArrays not defined
. What's the reason and how can I fix this?
EDIT: This is what the relevant parts of the code look like:
module ExampleModule
import SparseArrays
include("example.jl")
end
example.jl
:
"""
f
does stuff.
"""
function f(x::SparseArrays.AbstractSparseArray)
return
end
index.md
:
```@docs
f(x::SparseArrays.AbstractSparseArray)
```
Most likely you have imported it in a separate code block. See here for an explanation of the issue.
Also you might need to add import SparseArrays
in setup code as explained here. This is needed if e.g. you have doctests inside docstrings.
Here is an example how it is done in DataFrames.jl (in general DataFrames.jl has doctests enabled both in docstrings and in documentation code so you can have a look at the whole setup we have there).
If this is not the reason then could you please share your code in the question so that it can be inspected?