Creating Julia Package Documentation

Dear All,
I am trying to create a website with the documentation for a Julia Package that I am helping to develop. I am using Julia 1.10 and the Documenter.jl package version v1.5.0.

I am following the instructions. I first created the docstrings in each function that I am exporting in the module. Then I am setting up the docs folder in the project folder as per instructions:

TaskBasedProduction/
├── docs/
│ └── make.jl
│ └── src/
├── src/
│ └── TaskBasedProduction.jl

TaskBasedProduction is the package that I am trying to build the documentation:

module TaskBasedProduction

include("common.jl")

include("unitInputDemand.jl")

include("component_positive_ups.jl")

include("component_negative_ups.jl")

include("margProdLabor.jl")

include("prod_fun.jl")

include("elasticity_sub_comp.jl")

include("is_density_function.jl")

include("unitInputDemand_general.jl")

include("prod_fun_general.jl")

include("margProdLabor_general.jl")

include("elasticity_sub_comp_general.jl")

include("numerical_derivative.jl")

export unitInputDemand, margProdLabor,margProdLabor_general, prod_fun, elasticity_sub_comp, unitInputDemand_general, prod_fun_general, elasticity_sub_comp_general

end # module

All the functions that I am not exporting are auxiliary functions. I documented all the functions that have to be exported. You can find the repo here: GitHub - haanwinckel/TaskBasedProduction: This is an example for a package for Task based production function.

This is my make.jl file:

# Add the path to the src directory of your package
push!(LOAD_PATH, "../src/")

using Documenter
using TaskBasedProduction

makedocs(
    sitename = "TaskBasedProduction.jl",
    modules  = [TaskBasedProduction],
    pages = [
        "Home" => "index.md"
    ]
)

This is my index markdown:

# TaskBasedProduction.jl

*Package for task-based production model.*

## Package Features

- Unit input demand calculator

- General unit input demand calculation

- General production function evaluation

- Specific production function evaluation

- Marginal productivity of labor calculation

- Elasticity of substitution and complementarity calculation

- General marginal productivity of labor calculation

- Elasticity of substitution and complementarity calculation general case

## Function Documentation

```@docs

unitInputDemand

unitInputDemand_general

prod_fun_general

prod_fun

margProdLabor

elasticity_sub_comp

margProdLabor_general

elasticity_sub_comp_general

When I run make.jl in my REPL I get the following error messages;


julia> include("make.jl")
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
┌ Error: 7 docstrings not included in the manual:
│ 
│     TaskBasedProduction.unitInputDemand :: Union{Tuple{AbstractArray{<:Real}, Real, Real, Real, AbstractArray{<:Real}}, Tuple{AbstractArray{<:Real}, Real, Real, Real, AbstractArray{<:Real}, Bool}}
│     TaskBasedProduction.unitInputDemand_general :: Tuple{Vector{Float64}, Real, Function, Vector{Function}}
│     TaskBasedProduction.prod_fun_general :: Tuple{AbstractArray{<:Real}, Real, Function, Vector{Function}}
│     TaskBasedProduction.prod_fun :: Tuple{AbstractArray{<:Real}, Real, Real, Real, AbstractArray{<:Real}}
│     TaskBasedProduction.margProdLabor :: Tuple{AbstractArray{<:Real}, Real, Real, Real, AbstractArray{<:Real}}
│     TaskBasedProduction.elasticity_sub_comp :: Tuple{AbstractArray{<:Real}, Real, Real, Real, AbstractArray{<:Real}}
│     TaskBasedProduction.margProdLabor_general :: Tuple{AbstractArray{<:Real}, Real, Function, Vector{Function}}
│ 
│ These are docstrings in the checked modules (configured with the modules keyword)
│ that are not included in canonical @docs or @autodocs blocks.
└ @ Documenter C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\utilities\utilities.jl:44
[ Info: Populate: populating indices.
ERROR: LoadError: `makedocs` encountered an error [:missing_docs] -- terminating build before rendering.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] runner(::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Document)
    @ Documenter C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\builder_pipeline.jl:253
  [3] dispatch(::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Document)
    @ Documenter.Selectors C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\utilities\Selectors.jl:170
  [4] #86
    @ C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\makedocs.jl:248 [inlined]
  [5] withenv(::Documenter.var"#86#88"{Documenter.Document}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
    @ Base .\env.jl:257
  [6] #85
    @ C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\makedocs.jl:247 [inlined]
  [7] cd(f::Documenter.var"#85#87"{Documenter.Document}, dir::String)
    @ Base.Filesystem .\file.jl:101
  [8] #makedocs#84
    @ C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\makedocs.jl:247 [inlined]
  [9] top-level scope
    @ C:\Users\lenovo\.julia\dev\TaskBasedProduction\docs\make.jl:7
 [10] include(fname::String)
    @ Base.MainInclude .\client.jl:489
 [11] top-level scope
    @ REPL[154]:1
in expression starting at C:\Users\lenovo\.julia\dev\TaskBasedProduction\docs\make.jl:7


I am really struggling to understand why this is not working and any help would be greatly appreciated.

I think you are missing the final triple backticks ``` at the end of your index.md.

Hi Joshua,
Thank you for your feedback. I tried that, in that case I obtain the following error message

Error: no docs found for 'elasticity_sub_comp_general' in `@docs` block in src\index.md:18-27
│ ```@docs
│ unitInputDemand
│ unitInputDemand_general
│ prod_fun_general
│ prod_fun
│ margProdLabor
│ elasticity_sub_comp
│ margProdLabor_general
│ elasticity_sub_comp_general
│ ```
└ @ Documenter C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\utilities\utilities.jl:44
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
ERROR: LoadError: `makedocs` encountered an error [:docs_block] -- terminating build before rendering.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] runner(::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Document)
    @ Documenter C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\builder_pipeline.jl:253
  [3] dispatch(::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Document)
    @ Documenter.Selectors C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\utilities\Selectors.jl:170
  [4] #86
    @ C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\makedocs.jl:248 [inlined]
  [5] withenv(::Documenter.var"#86#88"{Documenter.Document}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
    @ Base .\env.jl:257
  [6] #85
    @ C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\makedocs.jl:247 [inlined]
  [7] cd(f::Documenter.var"#85#87"{Documenter.Document}, dir::String)
    @ Base.Filesystem .\file.jl:101
  [8] #makedocs#84
    @ C:\Users\lenovo\.julia\packages\Documenter\qoyeC\src\makedocs.jl:247 [inlined]
  [9] top-level scope
    @ C:\Users\lenovo\.julia\dev\TaskBasedProduction\docs\make.jl:7
 [10] include(fname::String)
    @ Base.MainInclude .\client.jl:489
 [11] top-level scope
    @ REPL[4]:1
in expression starting at C:\Users\lenovo\.julia\dev\TaskBasedProduction\docs\make.jl:7

This is the function that is creating those problems:

“”"

elasticity_sub_comp_general(labor_input::AbstractArray{<:Real}, z::Real, b_g::Function, e_h::Vector{Function}) → (AbstractArray{<:Real}, AbstractArray{<:Real})

Calculates the elasticity of substitution and complementarity for a given set of parameters.

Arguments

  • labor_input: An array of labor inputs of different types with H elements.

  • z: Productivity parameter.

  • b_g: General task density function.

  • e_h: Vector of comparative advantage functions.

Returns

  • ϵ_h_sub: Matrix of elasticity of substitution values for each worker type h (rows) relative to worker type h_prime (columns).

  • ϵ_h_compl: Matrix of elasticity of complementarity values for each worker type h (rows) relative to worker type h_prime (columns).

“”"

function elasticity_sub_comp_general(labor_input::AbstractArray{<:Real}, z:: Real, b_g::Function, e_h::Vector{Function})

....... function goes here


end

The problem is probably that you have two newlines between the docstring and the function definition of elasticity_sub_comp_general. The function definition always has to be in the following line after the docstring.

Unfortunately it is still giving me the same error message

I just tested it locally and the docs successfully built for me (with your latest commit including the two fixes from above).

Thank you Joshua, I closed and reopened julia, re-run everything and now it worked… I don’t know what was going wrong before. I appreciate your help.