Skip to content

Need a registration hook for other plugins #237

@fralau

Description

@fralau

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationDocumentation is requiredenhancementNew feature or requestfixedA fix has been submitted

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions