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

Feature request: Code highlight #35

Open
rogercarrijo opened this issue Mar 31, 2023 · 7 comments
Open

Feature request: Code highlight #35

rogercarrijo opened this issue Mar 31, 2023 · 7 comments

Comments

@rogercarrijo
Copy link

It would be very good to add code highlighting as it happens in chatGPT.

I changed the code using the same libraries you used and the result was this:
image

To allow this just import the library import { Prisma } from '@mantine/prism';
and changed the code, as below:

                code: ({ node, inline, className, children, ...props }) =>
                  inline ? (
                    <Code {...props} children={children} />
                  ) : (
                    <Box sx={{ position: "relative" }}>
                      {className ? (
                        <Prism
                          language={
                            className.replace("language-", "") as Language
                          }
                        >
                          {getCode(children)}
                        </Prism>
                      ) : (
                        <Code block {...props} children={children} />
                      )}
@GromNaN
Copy link

GromNaN commented Apr 7, 2023

How can we detect the langage of the code sample?

@thavelick
Copy link

highlight.js supports syntax highlighting with language detection

@thavelick
Copy link

Made a quick PR for this!: #54

@thavelick
Copy link

Note, poking around in the developer console for ChatGPT, it seems like they're using hljs too. This means, with the above PR we should have the same quality (or lack thereof) of highlighting as they do!

@OctopBP
Copy link
Contributor

OctopBP commented Jul 19, 2023

Made another implementation before I saw this. Maybe it will be useful too #68

@OctopBP
Copy link
Contributor

OctopBP commented Jul 19, 2023

Add support for almost all languages

@OctopBP
Copy link
Contributor

OctopBP commented Jul 27, 2023

Hey @deiucanta! Can you please check this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants