The documentation for LFortran is built with sphinx
To build the documentation you will need the following dependencies
- sphinx-build for building the pages
- sphinx-intl for translations
- sphinx-material for the page theme
- sphinx-copybutton to allow copying of code-blocks
- myst-parser for markdown support
- nbsphinx for converting notebooks
- LFortran with jupyter kernel for the notebook conversion
You can install all required dependencies using the mamba package manager as shown in the next section.
First create and load the Conda environment:
cd doc
mamba env create -f environment.yml
conda activate lfortran_docs
To build the documentation run the build.py
script:
python build.py
To view the rendered pages start a http server:
python -m http.server -d site
And go to: http://localhost:8000/en/
You can also pass the language as an argument to only build part of the site
python build.py en de
To update the documentation edit the markdown files in the doc/src
directory.
If you add new files in Markdown (md
) or Notebook (ipynb
) format, make sure to include them in a toctree directive.
To update the translation files after an addition to the docs, run
python intl.py
New translations can be added in doc/src/_static/languages.json
.
Make sure the default language (English) is always first.
Translations can be contributed via weblate.
The documentation can also be translated by editing the po-files in doc/locale
.