KevinBatdorf / code-block-pro

A Gutenberg code block with syntax highlighting powered by VS Code
https://code-block-pro.com
130 stars 10 forks source link

Feature Request: `console` or `terminal` syntax highlighter #330

Open spkane opened 2 months ago

spkane commented 2 months ago

I have come across syntax highlighters in the past that have a concept of a console highlighter, which is different from things like bash and powershell and is designed to be a bit more aware of the prompt, and the fact that the block, is likely one of more commands at a prompt followed by output that is very likely pseudo-plain text, versus any parse-able programming language.

It would be nice to have something like this.

Ideally, it would detect common prompts at the start of the line like $, #, C:\, and PS \> (or whatever the Windows ones are), parse the command in a reasonable fashion highlighting various standard arg types and their values, and then treating the output as more standard text output. It would be great if there were some way to tell it what the output was (or if it could try to make a reasonable guess), but that might be wishful thinking on my part. :-)


Also, this is a really great plugin. I am very excited to have found it in my searches and was more than happy to buy the theme pack and advanced features!

KevinBatdorf commented 2 months ago

Thanks for this feedback. The way the engine works is it uses TextMate grammars in the same way VS Code does, so there would have to be an existing grammar for it. I'm guessing this is too unique of an experience for there to be an existing solution though since this is specific to presentation on a blog.

I do like the idea though in general, but it almost could be it's own plugin too since the features are unique to that experience only. I have thought about adding a more general "output" section (maybe even with compiled/rendered output) that could sit under the code, but I'm not sure when I'll be able to work on that, or if that would even fit here how you're imaging it.