diff --git a/mkdocs_macros/plugin.py b/mkdocs_macros/plugin.py index 7b35672..62becb2 100644 --- a/mkdocs_macros/plugin.py +++ b/mkdocs_macros/plugin.py @@ -327,7 +327,7 @@ def raw_markdown(self, value): # ---------------------------------- # Hooks for other applications # ---------------------------------- - def register_macro(self, items:dict): + def register_macros(self, items:dict): """ Register macros (hook for other plugins). These will be added last, and raise an exception if already present. @@ -336,9 +336,11 @@ def register_macro(self, items:dict): # after on_config self._macros register_items('macro', self.macros, items) + self.variables["macros"].update(self.macros) + self.env.globals.update(self.macros) except AttributeError: # before on_config: store for later - self._add_macros += items + self._add_macros.update(items) def register_filters(self, items:dict): """ @@ -346,12 +348,13 @@ def register_filters(self, items:dict): These will be added last, and raise an exception if already present. """ try: - # after on_config self._filters register_items('filter', self.filters, items) + self.variables["filters"].update(self.filters) + self.env.filters.update(self.filters) except AttributeError: # before on_config: store for later - self._add_filters += items + self._add_filters.update(items) def register_variables(self, items:dict): """ @@ -364,7 +367,7 @@ def register_variables(self, items:dict): register_items('variables', self.variables, items) except AttributeError: # before on_config: store for later - self._add_variables += items + self._add_variables.update(items) # ---------------------------------- # Function lists, for later events