Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code highlight #2

Closed
yesmeck opened this issue Dec 4, 2022 · 5 comments
Closed

code highlight #2

yesmeck opened this issue Dec 4, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@yesmeck
Copy link

yesmeck commented Dec 4, 2022

It appears that ChatGPT returns a markdown format. Using a markdown rendering library would make the results more readable.

@yesmeck yesmeck changed the title highlight code code highlight Dec 4, 2022
@wong2
Copy link
Owner

wong2 commented Dec 5, 2022

That's definitely in the TODO

@wong2 wong2 added the enhancement New feature or request label Dec 5, 2022
@jameszu
Copy link
Contributor

jameszu commented Dec 9, 2022

Hi there,
I managed to get the CSS code highlighted but not the other languages : (

CSS code highlight

Here is the response from the API, as you can see it includes CSS after ```

CSS code response

It turns out the chatgpt API only response ``` without the language identifier for language like js, python, java and etc. The following screenshot shows part of the response when asking "blinking effect in javascript"
jscode response

Shall I create a PR or shall we wait and see if anyone else has a better idea on code highlights?
Cheers : )

@wong2
Copy link
Owner

wong2 commented Dec 9, 2022

I'm curious about your current approach

@jameszu
Copy link
Contributor

jameszu commented Dec 9, 2022

Added the highlightjs css file and used the code from markdown-it documentation as the following
https://markdown-it.github.io/markdown-it/
highlightjs code

@jjroley
Copy link

jjroley commented Dec 13, 2022

You could tryhljs.highlightAuto()

@wong2 wong2 closed this as completed Dec 15, 2022
chinpeerapat referenced this issue in chinpeerapat/chatgpt-google-extension Dec 28, 2024
* Install @geist-ui/icons package

* Add PromptCard component

* Update <main> tag width from 500 to 600

* Update PromptCard save button style

* Display error toast when saving new prompt fails

* Handle onClick event of remove icon in PromptCard

* Display prompt overides using PromptCard

* Add AddNewPromptModal component

* Use matching prompt for current hostname

* Fix: PromptCard disappears when prompt is updated

* Validate input first when adding new prompt

* Initialize states in AddNewPromptModal before close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants