by Subhaditya Mukherjee
Here we will talk about how to document your code using Documenter.jl and a few tips along the way.
Before we go on, look at this as an example. Source
[Edit] : Adding on to using the helpful hints from link
I know. It is really boring and why would you bother anyway. Or. “This is only for me”. Trust me I have been in your shoes for a majority part of my coding life. Which funnily enough has only been there for around 4 years. Of which the first doesn’t even count.
But we are coders! So how do we go about making it easy to maintain.
We will be using a package called Documenter.jl for this although it would be easy enough to implement things if we wanted to. But since a package exists, why reinvent the wheel.
What this allows us to do is write documentation in the code itself which we do anyway and convert it into a website. I had written something similar for Python a long time ago but this takes it further by allowing full markdown support. Which means you can do pretty much anything without too much drama.
The process is a bit wonky so the aim of this is to give you a nice flow of how to use it.
]add PkgTemplates using PkgTemplates t = Template() t("MyPkg")
This will create a bunch of default folders which we will use.
Note that PkgTemplates can generate the documentation for you. It requires a bit of tinkering but you can skip a few steps if you want. (Go to step 8 directly :) )
Project.toml (To take care of related dependencies)
Tip: If you have a clean repo you can do this to speed up your workflow
$ julia --project=docs/ pkg> instantiate pkg> dev . julia> include("docs/make.jl")
using Documenter, classification, Datasets Documenter.makedocs( sitename = "DDL Documentation", repo = "https://github.com/SubhadityaMukherjee/DDL.jl" )
```@autodocs Modules = [modulename] `` `
Some tips from experience..
url: The url to be downloaded dest: Path fname: File name ```julia downloader("http://www.julialang.org/", "/tmp/","index. html")```
It will save your life over and over again. Here is the best cheat sheet I found to learn it CHEAT
If you want to automate this workflow, use a github action