rosscdh / mkdocs-markdownextradata-plugin

A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template
MIT License
83 stars 18 forks source link

Extra variables for html files #46

Closed charlstown closed 1 year ago

charlstown commented 1 year ago

Hi,

I'm using mkdocs-markdownextradata-plugin with mkdocs 1.4.2 and python 3.10. I have added the extra data in my mkdocs.yml file under extra like in the README:

extra:
  customer:
    name: Your name here
    web: www.example.com
    salt: salt.example.com

The plugin is working fine and I can access the extra data in my .md files like this: {{ customer.name }}. However, I was wondering if it is possible to use these extra values in other files, such as HTML or CSS files in the override folder of my theme.

For example, I want to use the customer.name value in my theme/overrides/custom.html file. Is there a way to do this?

I've tried using the mkdocs serve command, but it returns me a Jinja undefined error and doesn't seem to include the extra data in the output HTML files. Any help or guidance on this issue would be greatly appreciated.

Thanks in advance.

rosscdh commented 1 year ago

Sorry unfortunately not, as mkdocs does not treat those files as templates but rather as static files so dont get the templating pass afaik.