MkDocs Data Plugin is a plugin for MkDocs that allows reading data from markup files and use it in your Markdown pages.
Currently supported formats:
- JSON:
.json
- YAML:
.yml
,.yaml
This plugin documentation can be found here: https://joapuiib.github.io/mkdocs-data-plugin/
This plugin can be installed via pip:
pip install mkdocs-data-plugin
Activate the plugin in your mkdocs.yml
:
plugins:
- macros
- data
When using this plugin, you can define data in YAML or JSON files in a separate directory and reference them in your Markdown files.
root/
├── docs/
│ └── ...
├── data/
│ └── fruits.yml
└── mkdocs.yml
- Apple
- Banana
- Strawberry
Files in this directory can be referenced in your Markdown files using the data
variable.
{% for fruit in data.fruits -%}
- {{ fruit }}
{% endfor %}