Closed ddorian closed 7 months ago
Welcome to this project and thank you!' first issue
It is important to note that Mkdocs-Macros was designed as a Jinja2 template engine for the markdown documents.
It is entirely distinct from MkDoc's Jinja2 templating engine for the html templates.
You can, to a limited extent, make the two interact: here is the description of the "state of the art" on how to "trickle" values from a markdown page to an html template.
I wasn't aware that the config
object was present in the standard Mkdocs Jinja2 engine. If that's the case, then yes, {{ config.extra.unit_price }}
would work! That's not a feature of Mkdocs-Macros, but of MkDocs itself.
The fact that a non-existent variable gives an empty string does not suprise me (by contrast, the Mkdocs-Macros template engine would display an error message in the page, in that case). If you wish to know how to change that behavior (if that's possible), you would have to consult the the MkDocs documentation, or open a question or issue on their project repository.
If the point about {{ config.extra.unit_price }}
is confirmed, that would definitely deserve to be documented under the paragraph HTML pages.
It is entirely distinct from MkDoc's Jinja2 templating engine for the html templates. If you wish to know how to change that behavior (if that's possible), you would have to consult the the MkDocs documentation, or open a question or issue on their project repository.
Thank you.
If the point about {{ config.extra.unit_price }} is confirmed, that would definitely deserve to be documented under the paragraph HTML pages.
Just tested and this works with default mkdocs, without the plugin.
Using the simple example https://mkdocs-macros-plugin.readthedocs.io/en/latest/#simple-example
The defined variable in mkdocs.yml:
Prints black string
` when put as
{{ unit_price }}` in an overridden template.It works in this format though
{{ config.extra.unit_price }}
.The problem is that it doesn't cause an error with the configuration above but prints blank string.