Sample Documentation
This page shows how to pull in the doc strings in your code.
The first thing to do is insert
```@meta
CurrentModule = AlgamesDriving # your package name here
```
which sets the module to your package so you don't have to prepend the methods with your package.
Pulling in some docstrings
First, let's pull in the docstrings for vec_add!
and vec_sub!
, which we can do using
```@docs
vec_add!
vec_sub!
```
This inserts the following into our markdown file:
Missing docstring for vec_add!
. Check Documenter's build log for details.
Missing docstring for vec_sub!
. Check Documenter's build log for details.
Notice how in the vec_add!
docstring we included both signatures in a single docstring, but vec_sub!
had two separate docstrings. We can select only one of the docstrings by filtering with the input signature:
```@docs
vec_sub!(::VecPair)
norm(::VecPair)
```
which inserts only one docstring,
Missing docstring for vec_sub!(::VecPair)
. Check Documenter's build log for details.
Linking Docstrings
We can link to the docstring for vec_add!
using the [
vec_add!](@ref)
syntax. Note the tick marks around the method, inside the square brackets. We can also do this inside the docstring themselves, like we do in the docstring for VecPair
:
Missing docstring for VecPair
. Check Documenter's build log for details.
For illustration, we also show in this docstring how to include $\LaTeX$ math inside the docstring. For reference, we've copied the raw docstring below:
"""
VecPair{V}
Holds two vectors of the same length and type.
The vectors can be retrieved using `v.a` and `v.b` or `v[1]` and `v[2]`.
Supports [`vec_add!`](@ref) and [`vec_sub!`](@ref).
Here is some ``\\LaTeX`` for you:
math \sum{i=1}^N xk^T Qk xk
# Constructors
VecPair{V}(a,b)
VecPair(a::V, b::V)
VecPair(a::StaticVector, b::StaticVector)
"""