-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
An option to create and save a Code Block "Template" #264
Comments
Great feedback! Thank you. I was going to work on something like that this weekend, actually, so it's a good signal someone else felt the same. I have two questions though:
|
Awesome!
|
Well you could do this today actually.
-- Instead I'll probably make something in a dropdown that will let you quickly swap around after the fact. Similar to how you select a theme today. |
Sweet! I didn't know that. That is essentially what I was requesting. That is perfect. Thanks! |
But does that not update the code block contents across all posts? I've had to convert to regular block before editing, and learned the hard way when I erased my code blocks in other posts because I forgot to convert. |
That's correct. Each block would need to be updated one by one. The reason is it uses the VS Code engine to pre-process the tokens in the code in the browser's webassembly runtime (it happens in real time as you type). It can't process them outside of the browser, so updating a setting in one place wouldn't be able to process every other block on the page. It's just not possible. The trade off here is the blocks are pre-rendered as you type, that's in contrast to other plugins that render on the server or frontend right when the user requests the page. Speed/performance vs not having a global setting. I'm working on a solution to let people re-render them in a more efficient way through an admin page that loads everything in and processes them, but it's not ready yet, and I need to be careful how it operates. |
Having the ability to set defaults for 1) theme, 2) header type, 3) footer type, 4) copy button icon, 5) font styling, 6) max height, 7) disable padding, 8) tab settings, 9) line numbers, and 10) additional CSS classes would make this plugin significantly more practical to use for a code snippet heavy website. The rest of the settings could reasonably be expected to change per instance, so defaults make less sense. If there was a batch reprocessing feature, the ability to "override a default" would be needed, since some settings might need to be occasionally overridden (like the header, I generally have 50% with a title and 50% without). |
It would be nice to be able to create saved templates for code blocks. For example, to be able to add all the main settings we want like size, spacing, theme color, etc. then save that template and have it apply to every code block that gets placed in Gutenberg.
Maybe they can also have an option to import/export templates as well.
The text was updated successfully, but these errors were encountered: