You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some custom templates (using the custom_dir setting in MkDocs) which the macros apparently can't access. Setting include_dir to include my custom templates does not work. Perhaps this is not supported?
Macros are used/rendered in the on_page_markdown event and are supposed to be used in md files, while templates are used later in the build and macros are not supposed to be used in them, afaik (despite the syntax being kinda the same, they are not registered in the Jinja environment. You can add your own functions to the Jinja environment through the on_env event, on the other hand).
Reacted by Laurent Franceschetti
Repository owner locked and limited conversation to collaborators on May 3, 2026
Activity
github-actions commentedon Nov 17, 2025
Welcome to this project and thank you!
FredZinelli commentedon Dec 19, 2025
What are you trying to do exactly?
Macros are used/rendered in the
on_page_markdownevent and are supposed to be used in md files, while templates are used later in the build and macros are not supposed to be used in them, afaik (despite the syntax being kinda the same, they are not registered in the Jinja environment. You can add your own functions to the Jinja environment through theon_envevent, on the other hand).