xenodium / chatgpt-shell

A multi-llm Emacs shell (ChatGPT, Claude, Gemini, Kagi, Ollama, Perplexity) + editing integrations
https://lmno.lol/alvaro
GNU General Public License v3.0
869 stars 77 forks source link

Language-specific syntax highlighting in source blocks #17

Closed mcraveiro closed 1 year ago

mcraveiro commented 1 year ago

Hi,

Thanks for an amazing mode, I am experimenting with it a lot and its really useful. I have one request though, is it possible to somehow integrate Markdown mode, with possibly a way to narro to the code regions? I ask this because the output with code is already annotated correctly by GPT:

ChatGPT> what is quantlib DayCounter?

Here's an example code that demonstrates the usage of `DayCounter` in QuantLib: ```cpp #include #include using namespace QuantLib; ```

So if there was a way to make this region follow markdown mode like say org-mode does it would be great.

Thanks for your time.

xenodium commented 1 year ago

Thanks for filing. Do you mean the ability to use functions like markdown-mark-block and markdown-narrow-to-block? Those seem to work as is, so maybe need to be added as bindings to the mode map? Or do you mean other functions? Specific ones used in your workflow would help.

mcraveiro commented 1 year ago

Thanks for the prompt reply. Actually, now you say that, maybe its just me. Let me describe with examples. This is my plain ChatGPT buffer:

Screenshot from 2023-03-24 11-33-54

And this is what I see with markdown mode:

Screenshot from 2023-03-24 11-36-47

And finally, this is what one would see with org-mode source blocks:

Screenshot from 2023-03-24 11-37-42

So I guess what I am saying with all my rambling is, it would be great if somehow one could get the syntax highlighting one gets on org-mode blocks. However, I didn't even realise its not available within markdown mode, so maybe I'm asking for something crazy :-)

xenodium commented 1 year ago

Got it. I've updated the title.

Not sure how best to achieve language specific highlighting yet, but let's keep the feature request. It'd be a nice goal to achieve.