How to locally build the MANTIS docs.
The main file structure of the the docs has now been created, so you only have to build the documentation. Fortunately, the heavy lifting will be done by Julia and/or Python.
For convenience, there is a bash script in the tools folder, build_local_docs.sh, that automates the process. Make sure to run the script starting in the main Mantis folder. Use
bash tools/build_local_docs.shIf this does not work, or if you prefer to go through the steps yourself, you can use the following step-by-step guide.
To create the docs, follow these steps:
Navigate to the
docs/directory. If you open a terminal in theMantisrepo, this is a simple matter of executingcd docs(or the equivalent on your system) in your terminal.
Next, run
julia --color=yes --project make.jlin this directory (you can leave the
--color=yesoption out if you don't want the printed output to be coloured). This will update (or generate if it doesn't exist yet) abuild/-directory in thedocs/-directory[1]. All.htmlfiles are generated here. Make sure that you save all changes before running this command or you won't see the changes! Should this step fail, see the next step.If the dependencies of
Mantischanged, the build may fail when building in thedocs/-folder. This is because thedocs/-folder defines its own julia environment, since the documentation may have different dependencies thanMantisitself. To update the environment, open a terminal in thedocs/-directory and typejuliato open julia. Enter the package manager by typing]and activate the current environment by typingactivate .. The environment is shown in parenthesis '()' and should say 'docs'. Typedev ../../Mantis.jland execute this command. Note that../../Mantis.jlrefers to the folder name. If you did not call this Mantis.jl, make sure to use to correct name. The environment will be updated so that the latest version ofMantisis available with its updated structure. Then you may also have to runinstantiateto make sure thedocs\-environment is updated. You can now redo the previous step.Then you need to create a (local) webserver to view the HTML docs, for which there are a few options, see the Documenter Docs. Since I have
Pythoninstalled, I use the python option. Runpython -m http.server --bind localhost(after, in my case, activating my conda environment by executing
conda activate) in thedocs/-directory. You may have to usepython3 -m http.server --bind localhostinstead. Alternatively, you can use Julia with
LiveServer.jl:julia -e 'using LiveServer; serve(dir="build")Note that the automate script tries all these options for you.
In my case, this will result in VScode giving me the message:
Your application running on port 8000 is available. See all forwarded portswith the optionsOpen in BrowserandPreview in Editor. Click theOpen in Browser-option to see the html pages. You (may) have to click thebuild/-link when the browser opens.Enjoy the
Mantisdocs!In my case, this will result in VScode giving me the message:
Your application running on port 8000 is available. See all forwarded portswith the optionsOpen in BrowserandPreview in Editor. Click theOpen in Browser-option to see the html pages. You have to click thebuild/-link when the browser opens.Enjoy the
Mantisdocs!When done, you can kill the local webserver by using
Ctrl+C.
The
docs/build/-folder should never be gitted. (See also the warning in the Documenter Docs). The.gitignore-file is already setup to prevent this. ↩︎