pawamoy / markdown-exec

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

Disable All Execution #59

Open loricah opened 3 months ago

loricah commented 3 months ago

Describe the solution you'd like

I’d like to see some global argument that I can specify in my mkdocs.yaml or somewhere else that disables all execution, yet still renders the code blocks properly.

Describe alternatives you've considered

With mkdocs versions greater than 1.6, I can add the following to the plugin:

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

but this completely breaks the results.

Edit: spelling

pawamoy commented 3 months ago

That's probably because without specifying the custom fences, exec options aren't recognized anymore by the default fences, and the rendering breaks. I don't see how we can prevent that if the plugin is never loaded because of enabled: false :thinking:

pawamoy commented 3 months ago

Ah, the plugin should probably implement its own enabled option that sets it in a "do nothing" mode instead of completely disabling it.