As explained by @timvink in squidfunk/mkdocs-material#5933, writers of other plugins would need some hook to declare variables, macros and filters before the Mkdocs-Macros is actually run.
The rule adopted is following: three methods register_variables(), register_macros() and register_filters().
To facilitate work, these three method should work regardless of the order of declaration of plugins.
- The other plugin is declared before Mkdocs-Macros (its
on_config() is run before MacrosPlugin.on_config()): they will be stored for later, and added last to the list of variables, macros or filters.
- The other plugin is declared after: they are immediately added to the list of variables, macros or filters.
In both cases, those keys are added on top of all other ones. Duplicate keys are not allowed and will cause a KeyError.
As explained by @timvink in squidfunk/mkdocs-material#5933, writers of other plugins would need some hook to declare variables, macros and filters before the Mkdocs-Macros is actually run.
The rule adopted is following: three methods
register_variables(),register_macros()andregister_filters().To facilitate work, these three method should work regardless of the order of declaration of plugins.
on_config()is run beforeMacrosPlugin.on_config()): they will be stored for later, and added last to the list of variables, macros or filters.In both cases, those keys are added on top of all other ones. Duplicate keys are not allowed and will cause a KeyError.