chatpad icon indicating copy to clipboard operation
chatpad copied to clipboard

Feature request: Code highlight

Open rogercarrijo opened this issue 1 year ago • 7 comments

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} />
                      )}

rogercarrijo avatar Mar 31 '23 04:03 rogercarrijo