markdown syntax for mkdocs + material⚓
WORK IN PROGRESS
This site is generated from markdown files with mkdocs accompanied by the material theme via the gitlab CI gitlab CI
This page lists the specific syntaxes used for this site and the site https://mee-labs.gitlab-pages.imt-atlantique.fr/
and explains how to generate such a site from https://gitlab.imt-atlantique.fr/
Structure of a git repository for mkdocs + material⚓
📁 My-chaton-site/
├── 📁 docs/
│ ├── 📁 img/
│ │ └── 📄 chaton-1-resized.jpg
│ └── 📄 accueil-chaton.md
├── 📄 mkdocs.yml
├── 📄 requirement.txt
├── 📄 .gitlab-ci.yml
└── 📄 README.md
docs: directory in which the content of the site is located, text in markdown format, images, videos etc. It is possible to create subdirectories to better organize the content (img/in the example above).mkdocs.yml:yamlconfiguration file ofmkdocs- Site information (name, repository link, etc.)
- Organization of the site menu
- List of plugins and extensions used
- List of additional CSS and javascript
requirement.txt: list of python packages to install to generate the site.gitlab.ci.yml:yamlfile of the gitlab CI. This is the list of actions to be performed to generate and deploy amkdocssiteREADME.md: entry point of the git/gitlab repository documentation.
links and anchors⚓
A simple link⚓
1 | |
A link that opens in a new tab⚓
This is done with the option {:target="_blank"}:
1 | |
A link to a section of the current page (anchor)⚓
Each title generates an anchor link that can be addressed.
1 | |
1 2 3 4 5 6 7 8 9 10 | |
Creating the link to this anchor:
1 | |
Creating a link to another page of the site⚓
1 | |
And we can even make a link to a particular section, in a new tab:
1 | |
Managing figures⚓
Simple addition of a figure⚓
1 | |
Note
Here again, we can see that it is a relative path to the image. So it depends on the structure of your project.
Customize figure with CSS⚓
You need a CSS file (for example in docs/assets/extra.css)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
Then, you can apply these options on an image with the previously defined css option:
1 | |
You can see that the image is centered and has shadow.
Adding a figure with HTML⚓
Useful to add image caption
source: https://squidfunk.github.io/mkdocs-material/reference/images/
markdown_extensions: - attr_list - md_in_html - pymdownx.blocks.caption
1 2 3 4 | |
Local mkdocs server⚓
1 | |
http://127.0.0.1:8000.
Sources⚓
-
A slug is a unique string (typically a normalized version of title or other representative string), often used as part of a URL. The input form will render an error message if the current slug field is not unique https://www.sanity.io/docs/studio/slug-type ↩

