Skip to content

Add option to disable plugin in mkdocs.yml #478

@StefanBRas

Description

@StefanBRas

Is your feature request related to a problem? Please describe.
When editing sections of my docs that are not using mkdocstrings, the live preview takes a while to update because it will run mkdocstrings on every change.

Describe the solution you'd like
A config parameter in the plugin configuration section of the mkdocs.yml to disable the plugin. Together with the !ENV functionality of mkdocs it makes it easy to disable the plugin without having to modify the mkdocs.yml. So it could look like:

plugins:
- mkdocstrings:
    disabled: !ENV [DISABLE_MKDOCSTRING, False]
    default_handler: python
    handlers:
      python:
        options:
          show_source: false

I use another plugin mkdocs-simple-hooks which uses this pattern. Here the config option is enabled and defaults to True. I think it makes more sense to have it as disabled and default to False as you as default has it enabled and then can use this option if you want to disable it.

Describe alternatives you've considered

  • Comment out the mkdocstrings section of the mkdocs.yml. Works, but is annoying and I will accidentally commit the change when I run git add -u.
  • unwatch the sections of the docs which uses mkdocstrings. Not sure if it's possible to unwatch parts of the doc folder? In any case it would still be a problem when editing files that uses mkdocstrings but you are not focusing on that.

Additional context
I can make the PR if you think this change makes sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions