mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-14 00:54:43 +00:00
### What problem does this PR solve? some chunk method pictures are not in English #437 feat: set the height of both html and body to 100% feat: add SharedChat feat: add shared hooks ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
33 lines
892 B
TypeScript
33 lines
892 B
TypeScript
import Markdown from 'react-markdown';
|
|
import SyntaxHighlighter from 'react-syntax-highlighter';
|
|
import remarkGfm from 'remark-gfm';
|
|
|
|
const SharedMarkdown = ({ content }: { content: string }) => {
|
|
return (
|
|
<Markdown
|
|
remarkPlugins={[remarkGfm]}
|
|
components={
|
|
{
|
|
code(props: any) {
|
|
const { children, className, node, ...rest } = props;
|
|
const match = /language-(\w+)/.exec(className || '');
|
|
return match ? (
|
|
<SyntaxHighlighter {...rest} PreTag="div" language={match[1]}>
|
|
{String(children).replace(/\n$/, '')}
|
|
</SyntaxHighlighter>
|
|
) : (
|
|
<code {...rest} className={className}>
|
|
{children}
|
|
</code>
|
|
);
|
|
},
|
|
} as any
|
|
}
|
|
>
|
|
{content}
|
|
</Markdown>
|
|
);
|
|
};
|
|
|
|
export default SharedMarkdown;
|