-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
FR: Editable code blocks #5527
Comments
Thanks for suggesting. This was already asked before (can't find the issue right now, GitHub search, meh). Editing code blocks will mess with syntax highlighting, as we're doing highlighting during build time. When we would allow users to edit code blocks, the tokens entered wouldn't be highlighted. Additionally:
For this reason, we consider this feature request out-of-scope. There are already better solutions! |
I disagree, we have a use-case for that. One of internal mkdocs site provides terraform samples that are built to help devs just copy/paste the most common configurations and only have to modify a things like adding the name of their app, their projectId etc, and so peristance or execution isn't a goal at all. We've written some javascript functions to help with this but having something built-in would be a lot better. The link to google cloud docs that @ofek provided are a perfect example of that capability - the 'code' isn't meant to be executed within the mkdocs site, its just so that you can fill in the values with some assistance and then copy/paste somewhere else.
Looks like you're referring to this part specifically? https://pawamoy.github.io/markdown-exec/usage/pyodide/ |
Thanks for providing the examples. I imagine that something like this can be implemented with a custom Markdown fence, but it would probably need language-specific support to denote what parts of the code block should be editable and what not. We here at Material for MkDocs, cannot provide this functionality, as it doesn't make a lot of sense for us to do so, because it needs minimal support from themes. If somebody implements something like this that is generic enough and doesn't only apply to specific languages, we're happy to the necessary support on the theme side! |
Sure, I only happened to find this issue while searching for a plugin that might provide this exact feature. :) |
I think you'll rather need to implement a Markdown fence or extension, not a plugin, but I may be mistaken. |
Bug: Confict with code annotations (https://squidfunk.github.io/mkdocs-material/reference/code-blocks/?h=code+annotations#code-annotations) See #17 See squidfunk/mkdocs-material#5527 See squidfunk/mkdocs-material#4649 See https://pypi.org/project/markdown-exec/ See https://pawamoy.github.io/markdown-exec/usage/
Bug: Confict with code annotations (https://squidfunk.github.io/mkdocs-material/reference/code-blocks/?h=co> See https://squidfunk.github.io/mkdocs-material/contributing/reporting-a-bug/#remove-customizations See #17 See squidfunk/mkdocs-material#5527 See squidfunk/mkdocs-material#4649 See https://pypi.org/project/markdown-exec/ See https://pawamoy.github.io/markdown-exec/usage/
I would like to shamelessly self-promote an open source package (a custom fence) I created recently to solve this use case for anyone else who comes across this issue or is looking for this functionality: https://mkdocs-madlibs.readthedocs.io/en/latest/ Here's a sample: |
Nice! |
Context
No response
Description
Sections of code blocks may be templated with default values and may be modified by clicking which transforms that area to a text box. New lines should not be supported inside the text boxes.
Related links
https://squidfunk.github.io/mkdocs-material/reference/code-blocks/
Use Cases
This is useful when there is a desire for users to copy text or code and parts are defined by them.
Visuals
https://cloud.google.com/artifact-registry/docs/docker/pushing-and-pulling#tag
Before submitting
The text was updated successfully, but these errors were encountered: