-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variables don't work in overriden templates #200
Comments
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 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 |
Thank you.
Just tested and this works with default mkdocs, without the plugin. |
- The Jinja2 engine used for HTML templates is the standard one of MkDocs, and distinct from the macros engine.
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.
The text was updated successfully, but these errors were encountered: