Mkdocs Initial Setup
- Official site: https://squidfunk.github.io/mkdocs-material/
- Developer's GitHub: https://github.com/squidfunk/mkdocs-material
Setup Instructions
Pre-Requisites
- Download and install GitHub Desktop
- Download and install Python for Windows
- Download and install VS Code (if you don't already have it)
- Set up a virtual environment for Python
python -m venv venv
Install Mkdocs
-
Install mkdocs-material
pip install mkdocs-material -
Run the script to activate the virtual environment. This script will need to be run every time you edit/make changes to the website.
venv\Scripts\Activate.ps1 -
If you encounter an error about running scripts being disabled, you can run the following command and then run the Activate.ps1 script again
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -
Open the website in VS Code by typing the following command:
code .
Scaffold New Site
-
Open a new terminal if one is not already open and run the following commands:
mkdocs new .mkdocs serve -
Add the material theme to the mkdocs.yml file
theme: name: material -
Add the following to the mkdocs.yml file to add the light mode/dark mode toggle:
palette: # Palette toggle for light mode - scheme: default primary: green accent: purple toggle: icon: material/brightness-7 name: Switch to dark mode # Palette toggle for dark mode - scheme: slate primary: indigo accent: yellow toggle: icon: material/brightness-4 name: Switch to light mode -
Add the following to the mkdocs.yml file to add necessary features and plugins:
theme: name: material font: text: Roboto features: - content.code.annotate - content.code.copy - content.tabs.link - header.autohide - announce.dismiss - navigation.footer # - navigation.expand - navigation.indexes - navigation.instant - navigation.instant.progress - navigation.path - navigation.sections # - navigation.tabs - navigation.top - navigation.tracking - search.highlight - search.share - search.suggest # - toc.integrate plugins: - typeset - search - blog palette: # Palette toggle for light mode - scheme: default primary: red accent: red toggle: icon: material/brightness-7 name: Switch to dark mode # Palette toggle for dark mode - scheme: slate primary: red accent: red toggle: icon: material/brightness-4 name: Switch to light mode markdown_extensions: - admonition - pymdownx.details - pymdownx.superfences