mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 21:23:58 +01:00
improve markdown parsing
This commit is contained in:
parent
ddf467c038
commit
063316407d
|
@ -87,7 +87,17 @@ const ContentView = ({
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
components={{
|
components={{
|
||||||
code({ node, inline, className, children, ...props }) {
|
code({ node, inline, className, children, ...props }) {
|
||||||
const highlight = hljs.highlightAuto(children.toString());
|
if (inline) return <code>{children}</code>;
|
||||||
|
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 (
|
return (
|
||||||
<div className='bg-black rounded-md'>
|
<div className='bg-black rounded-md'>
|
||||||
<div className='flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans'>
|
<div className='flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans'>
|
||||||
|
|
|
@ -62,6 +62,13 @@
|
||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre ::-webkit-scrollbar-thumb {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
scrollbar-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
textarea:focus {
|
textarea:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue