This repository stores content for the Mathematical Modelling in Ecology and Evolution course (originally EEB430, now EEB314, at the University of Toronto) website. The website was created by @tomouellette -- many thanks!
Write your lecture content into a jupyter notebook and save it into the notebooks/lectures/ folder as lecture-X.ipynb (e.g. lecture-01.ipynb). If you have any images associated with this notebook, save them in a folder within notebooks/lectures/ called lecture-X-img/.
To build your interactive book, now enter the bin/ folder (i.e. cd bin from the root), and call the nb2imd.sh script as follows:
# Converts your notebook into an interactive markdown doc and moves it to correct folder
./nb2imd.sh -i ../notebooks/lectures/lecture-X.ipynb -o ../docs/lectures/
# If you have any images, move them to the correct folder
cp -r ../notebooks/lectures/lecture-X-img/ ../docs/lectures/lecture-X-img/where lecture-X is the name of the lecture.
Open the mkdocs.yml file and go down to the line that says nav. The structure of the nav section determines the layout of the website. If this is a new lecture named lecture-25.ipynb then add it do the nav section as denoted below:
nav:
- Overview: index.md
- Lectures:
- Lecture 01: lectures/lecture-1.md
- Lecture 25: lectures/lecture-25.mdNote that .ipynb is replaced with .md in the nav section.
The labs can be made using jupyter notebooks as before.
Once pushed to GitHub, use nbgitpuller to create a link to open them from the University of Toronto's JupyterHub.
You can view a local version of the website by calling mkdocs serve in the root of this folder (i.e. mkdocs.yml must be at the same level). Note you may need to install mkdocs and dependencies first with
pip install mkdocs
pip install mkdocs-materialIf everything looks good locally, you can build the site calling mkdocs build. A new folder called site will be built that has everything you need for hosting the live website. You can now push to publish via GitHub Pages (see https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions for more info).
The website was built using Material for MkDocs. Therefore, all the functionalitites described there can be added here if desired. Second, the executable cells were integrated using Thebe. If any changes to the code blocks are desired, please look at their documentation for more information. Alternatively, you can directly modify the style of the code blocks by editing the .css stylesheets stored in docs/stylesheets.
The nav section controls the site structure. Adding or removing tags will add or remove the corresponding page. For example, if you wanted to only hide a section of the website you could go to the nav in mkdocs.yml and do:
nav:
- Overview: index.md
- Lectures:
- Lecture 1: lectures/lecture-1.md
- Lecture 2: lectures/lecture-2.md
- Lecture 3: lectures/lecture-3.md
# - Lecture 4: lectures/lecture-4.md
# - Lecture 5: lectures/lecture-5.md
All the lines with # will be commented out and be removed from the site when you re-build. You can re-add them by uncommenting before re-building.