Kirby 3 code editor plugin

Is there a way to have a textarea as a code editor that keep the code formatting?
Thank you!

If you use three backticks before and after your code blocks, it will keep the formatting…

1 Like

For fields that only contain code, check out the monospace property:

If you add language highlighting, you can pass the language after the opening backticks…

    /// some code

Thank you @texnixe! I was looking for something like this but for Kirby 3:

Still looking for an alternative! If you have suggestions, please let me know! :slight_smile:

The editor has a code block:

I just had a look and tried it but actually I was looking for a different thing.

At the moment I’m using a simple textarea (without any button) to add custom code in my page trough the panel but an editor like the one I linked in my previous answer would be useful! I don’t need to show the code… instead it will be rendered as HTML or CSS (for simple page related CSS customisations).

The textarea doesn’t have any colors, code formatting etc…

Anyway this new kirby editor you just suggested me is beautiful, I saw I can add the code block and then render it as HTML using a custom snippet but the editor is the same like having a textarea… so no colors, no formatting etc…

I agree that code highlighting would be a nice to have (as a plugin). I guess the reason I don’t really miss it personally is because for the documentation we don’t use the Panel but edit the text files manually.

Having said that, I’m not aware of any plugin that supports Panel syntax highlighting. Maybe if there is a need you can develop something with the community?

The Markdown field is based on CodeMirror which offers editing and syntax highlighting capabilities. Maybe it can be used as a base for such plugin:

That’s interesting… I know php but not as well as a developer…every time I tried to understand the dynamic of kirby’s plugin engine I crashed my head on the wall! :sweat_smile:

meanwhile I give it a try, I will ask to sylvainjule if he has some interest on adding this plugin… Thank you!