fabianmichael / kirby-markdown-field

Super-sophisticated markdown editor for Kirby 3, community built.
Other
160 stars 14 forks source link

Feature request: highlighting code block based on language specified #141

Closed miragecraft closed 2 years ago

miragecraft commented 2 years ago

Since you can designate a code block to be a specific language, I feel the editor should automatically highlight the code within the code block accordingly.

fabianmichael commented 2 years ago

@miragecraft You are absolutely right, but there’s a catch! Supporting a decent selection would require the editor to download the definitions for a lot of languages from the server. Since the plugin’s JS bundle is already around 400 kB, I really think that this would add way too much weight. Another problem is, that I would have to rewrite the whole editing part, because on the way how CodeMirror’s syntax highlighting works. For the Markdown theme, I override most of the defaults to get a clean and mostly monochrome look, which allows me to focus more on the text itself. Code editors usually have a color theme that applies to all languages and in our case, this would mean that I would also have to create a separate set of styling tags for Markdown.

TL;DR: This is way beyond the scope of what I’m willing to invest into this project, since I personally don’t write much code in the markdown field and most of my clients also don’t do that, so while it would be pretty cool, it is just not realistic. Sorry!