pawamoy / markdown-exec

Utilities to execute code blocks in Markdown files.
https://pawamoy.github.io/markdown-exec
ISC License
111 stars 8 forks source link

[Feature] Option to globally disable execution #19

Closed eddiebergman closed 5 months ago

eddiebergman commented 1 year ago

Is your feature request related to a problem? Please describe. For documentation with lots of executing example and live-reload, this can be a bit slow at times and no necessary while building non-code parts of the documentation. I'd like to turn it off while focusing on the text and later enable it while working on code snippets.

Describe the solution you'd like

plugins:
  - markdown-exec:
        enabled: !ENV [SOME_ENV_VAR, false]

This is similar to how the offline plugin works.

Describe alternatives you've considered None really, I tried the above solution in case it was a nice global option that mkdocs provided but sadly it's not.

Additional context I'd be happy to provide a PR with a little bit of guidance on:

pawamoy commented 1 year ago

Hey @eddiebergman, good idea! You can get inspiration from this PR: https://github.com/mkdocstrings/mkdocstrings/pull/504

pawamoy commented 5 months ago

MkDocs 1.6 adds an enabled setting to all plugins by default, so you can now do something like this:

plugins:
- markdown-exec:
    enabled: !ENV [ENABLE_MARKDOWN_EXEC, false]