Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: default behaviour for code blocs #24

Closed
andynameistaken opened this issue Aug 20, 2023 · 2 comments
Closed

Feature request: default behaviour for code blocs #24

andynameistaken opened this issue Aug 20, 2023 · 2 comments

Comments

@andynameistaken
Copy link

I'm using Code Emiter plugin for Obsidian which allows me to run code from code blocks, when I'm writing notes which I later publish to mkdocs with material theme.
Could you provide option for default behaviour for codeblocks?

Example:

Block with exec=on doesn't allow Code emitter to run

```python exec="on"
print("Hello Markdown!")
```

Maybe some config in mkdocs.yml allowing to execute regular codeblock might be good idea?
It would be nice, because:

  • documets will be more portable
  • person can focus more on what to write and not how to do it (most important thing I think)
@pawamoy
Copy link
Owner

pawamoy commented Aug 21, 2023

Hello, thanks for the feature request!

I initially didn't want to implement such a feature, but it could be very easy with an environment variable, so why not.

Basically something like

EXEC_AUTO = [lang.strip() for lang in os.getenv("MARKDOWN_EXEC_AUTO", "").split(",")]

# and in our validator
exec_value = (language in EXEC_AUTO) | _to_bool(inputs.pop("exec", "no"))

Happy to review a PR with these changes, otherwise I'll try to get to it soon 🙂

@andynameistaken
Copy link
Author

Could you put it inside when you have time? I never did PR in my life and I don't know how to do it (yet).

pawamoy added a commit that referenced this issue Jun 13, 2024
@pawamoy pawamoy closed this as completed Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants