diff --git a/src/components/Chat/ChatContent/Message/MessageContent.tsx b/src/components/Chat/ChatContent/Message/MessageContent.tsx index 23484b0..e818d88 100644 --- a/src/components/Chat/ChatContent/Message/MessageContent.tsx +++ b/src/components/Chat/ChatContent/Message/MessageContent.tsx @@ -87,7 +87,17 @@ const ContentView = ({ {children}; + let highlight; + + const match = /language-(\w+)/.exec(className || ''); + const lang = match && match[1]; + if (lang) + highlight = hljs.highlight(children.toString(), { + language: lang, + }); + else highlight = hljs.highlightAuto(children.toString()); + return (
diff --git a/src/main.css b/src/main.css index 16e01f5..8185ac1 100644 --- a/src/main.css +++ b/src/main.css @@ -62,6 +62,13 @@ border-radius: 9999px; } + pre ::-webkit-scrollbar-thumb { + display: none; + } + pre { + scrollbar-width: 0; + } + textarea:focus { outline: none; }