For full documentation visit mkdocs.org.
For full documentation visit https://squidfunk.github.io/mkdocs-material/.
Tip
You can also preview any open pull request at https://c2sm.github.io/pr-preview/pr-<pr-id>/
To quickly generate a view of the documentation clone this repository on your PC/laptop, then view the documentation in
a browser run ./serve:
Important
To run the serve script, you need to first install uv.
$ git clone git@github.com:${githubusername}/c2sm.github.io.git
$ cd c2sm.github.io
./serve
...
INFO - [08:33:34] Serving on http://127.0.0.1:8000/This generates the documentation locally, which can be viewed using a local link, typically http://127.0.0.1:8000/. The documentation will be rebuilt and the webpage reloaded when changed files are saved.
To build the docs in a site sub-directory:
./serve buildFirst install MkDocs
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtThe following commands are available:
mkdocs new [dir-name]- Create a new project.mkdocs serve- Start the live-reloading docs server (open second terminal to make changes).mkdocs build- Build the documentation site.mkdocs -h- Print help message and exit.
mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
All Markdown files are checked with
markdownlint-cli2 on every push and pull request.
The rules are configured in .markdownlint-cli2.yaml and adapted to Material for MkDocs
(4-space list indentation, admonitions, inline HTML elements, 120-character lines).
The SUMMARY.md navigation files are excluded there as well.
External links in docs/ must carry an icon and open in a new tab. scripts/format_external_links.py adds both,
and a GitHub workflow fails if a link is not formatted.
Install the pre-commit hooks once after cloning. Node.js is not required, since pre-commit installs it automatically on the first run:
pip install pre-commit
pre-commit installFrom then on, every git commit formats external links and fixes most lint issues in the staged files. If a hook
changes a file, the commit is aborted: review the changes, stage them with git add, and commit again. Errors that
cannot be fixed automatically are listed with file, line, and rule (e.g., docs/index.md:12 MD013/line-length).
To check and fix all files at once, for example after a failed CI check, run:
pre-commit run --all-filesTo skip the hooks for a single commit, use git commit --no-verify. The CI checks still apply.
The markdownlint extension
for VS Code reads .markdownlint-cli2.yaml and shows errors while typing.
- Line length (MD013) cannot be fixed automatically; wrap long prose lines by hand. Lines in code blocks and tables are exempt.
- Do not start a wrapped line with
-,*,+, or1., as it would become a new list item. - Indent content that belongs to a list item (paragraphs, code blocks) by 4 spaces. Otherwise, the list is split and its numbering restarts.
- Use headings instead of bold text on a line of its own (MD036).
- To disable a rule for a single line, add
<!-- markdownlint-disable-next-line MD013 -->above it. Use this sparingly.