Merge pull request #1086 from siiddhantt/fix/remark-gfm-incompatible

fix: updated both remark-gfm and react-markdown to compatible versions
This commit is contained in:
Alex
2024-08-20 18:02:18 +01:00
committed by GitHub
3 changed files with 733 additions and 497 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -29,11 +29,11 @@
"react-dom": "^18.3.1",
"react-dropzone": "^14.2.3",
"react-i18next": "^15.0.1",
"react-markdown": "^8.0.7",
"react-markdown": "^9.0.1",
"react-redux": "^8.0.5",
"react-router-dom": "^6.8.1",
"react-syntax-highlighter": "^15.5.0",
"remark-gfm": "^3.0.1"
"remark-gfm": "^4.0.0"
},
"devDependencies": {
"@types/react": "^18.0.27",

View File

@@ -226,19 +226,19 @@ const ConversationBubble = forwardRef<
className="whitespace-pre-wrap break-normal leading-normal"
remarkPlugins={[remarkGfm]}
components={{
code({ node, inline, className, children, ...props }) {
code(props) {
const { children, className, node, ref, ...rest } = props;
const match = /language-(\w+)/.exec(className || '');
return !inline && match ? (
return match ? (
<div className="group relative">
<SyntaxHighlighter
{...rest}
PreTag="div"
children={String(children).replace(/\n$/, '')}
language={match[1]}
{...props}
style={vscDarkPlus}
>
{String(children).replace(/\n$/, '')}
</SyntaxHighlighter>
/>
<div
className={`absolute right-3 top-3 lg:invisible
${type !== 'ERROR' ? 'group-hover:lg:visible' : ''} `}