chatgpt-google-extension
chatgpt-google-extension copied to clipboard
Code higlight for the response code blocks
Related #2
The code blocks from chatGPT responses can now be automatically highlighted in the corresponding language.

Thx to @jjroley for the awesome tip : )
Cheers, James
Hi, is your branch behind the main branch? The project does not use markdown-it anymore
Ah yes you are right I did not update it. I will see if there are other ways
Does rehype-highlight work for you?
Almost there, right now it doesn't have that auto detection thing like previous hightlight.js, but it should have one, I will let you know once I got it working : )
Hi @wong2
It should be all good for now.
A minor issue is that the hightlight.js CSS file has a default padding of 1em, which makes the code blocks look like this.
Hope that is not a big issue. I can look into it if you want the code blocks to have the same padding as before .
Cheers
I'd like to remove the padding, you can overwrite it in styles.css
Does the default theme work in dark mode?
- Padding is now working
- Unfortunately, the default CSS does not work well in dark mode. I tried to include the dark theme CSS file through an import in the style.css file at @ media (prefers-color-scheme: dark), but esbuild does not support conditional CSS import as for this issue.
One way would be adding all the dark CSS code into the media query for dark mode, but that would include lots of lines of code. 60 lines after prettier formatting.
Another way might require change of CSS files as the following:

I'm open to more ideas : )
Hi, I solved the theme problem here: https://github.com/wong2/chat-gpt-google-extension/pull/117/commits/cc92f923771a27c227f5736fdcd6d9b7a08a526d