{"id":21577,"library":"mkdocs-markdownextradata-plugin","title":"MkDocs Markdown Extra Data Plugin","description":"A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template, also supporting external data files via jinja2 templating. Current version 0.2.6, requires Python >=3.6, maintained with sporadic releases.","status":"active","version":"0.2.6","language":"python","source_language":"en","source_url":"https://github.com/rosscdh/mkdocs-markdownextradata-plugin","tags":["mkdocs","plugin","markdown","jinja2","data-injection","documentation"],"install":[{"cmd":"pip install mkdocs-markdownextradata-plugin","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"Required plugin host","package":"mkdocs","optional":false},{"reason":"Template rendering engine","package":"jinja2","optional":false},{"reason":"YAML parsing for extra files","package":"pyyaml","optional":false}],"imports":[{"note":"Module name uses underscores, not hyphens, and you must import the class for plugin registration.","wrong":"import markdownextradata","symbol":"MarkdownExtraDataPlugin","correct":"from mkdocs_markdownextradata_plugin import MarkdownExtraDataPlugin"}],"quickstart":{"code":"# mkdocs.yml\nplugins:\n  - markdownextradata:\n      data_source_folders: \"_data\"\n# Markdown file (e.g., index.md)\n# {{ extra['my_var'] }} or {{ my_var }} if defined in mkdocs.yml extras","lang":"python","description":"Enable the plugin in mkdocs.yml. Create a `_data` folder with YAML/JSON files (e.g., `_data/mydata.yaml`). Reference variables as `{{ mydata_key }}` in markdown."},"warnings":[{"fix":"Set `priority` in mkdocs.yml plugin config (e.g., priority: 50) or use `plugins: { markdownextradata: { ... }, search: { ... } }` with explicit order.","message":"The plugin uses `on_page_markdown` hook, which causes incompatibility with other plugins that also use that hook unless ordering is manually set.","severity":"breaking","affected_versions":">=0.1.7"},{"fix":"For `_data/team.yaml` with key `members`, use `{{ team.members }}` not `{{ extra.team.members }}`.","message":"Variable in template references `extra.` prefix only for values defined in mkdocs.yml `extra:`; for data files, use the filename without extension as variable name.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to >=0.2.4 or rename files to not start with a digit.","message":"Data source folder names starting with a number (e.g., `1_data.yaml`) are not read correctly.","severity":"gotcha","affected_versions":"<0.2.4"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Ensure mkdocs.yml has an `extra:` section (e.g., `extra: { my_var: value }`) and `data_source_folders` is set if using external files.","cause":"The plugin did not inject extra variables because they were not defined in mkdocs.yml `extra:` section or data source folder not configured.","error":"jinja2.exceptions.UndefinedError: 'extra' is undefined"},{"fix":"Run `pip install mkdocs-markdownextradata-plugin` and verify import with `from mkdocs_markdownextradata_plugin import MarkdownExtraDataPlugin`.","cause":"Plugin not installed or installed under a different name (e.g., using hyphens instead of underscores).","error":"ModuleNotFoundError: No module named 'mkdocs_markdownextradata_plugin'"},{"fix":"Check that your data file (e.g., `_data/my_data.yaml`) exists and the variable is at the top level. Use `{{ my_data.my_var }}` if the file is `my_data.yaml`.","cause":"Variable not found in the data context; might be in a nested data file or not loaded.","error":"KeyError: 'my_var' when using {{ my_var }}"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}