mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-10 04:22:27 +10:00
28 lines
637 B
TypeScript
28 lines
637 B
TypeScript
import clsx from 'clsx';
|
|
import isEmpty from 'lodash/isEmpty';
|
|
import ReactMarkdown from 'react-markdown';
|
|
import rehypeKatex from 'rehype-katex';
|
|
import remarkGfm from 'remark-gfm';
|
|
import remarkMath from 'remark-math';
|
|
|
|
type Props = {
|
|
children?: string;
|
|
className?: string;
|
|
};
|
|
|
|
const Markdown: React.FC<Props> = ({ className, children }) => {
|
|
if (!children || isEmpty(children)) return null;
|
|
|
|
return (
|
|
<ReactMarkdown
|
|
className={clsx('markdown', className)}
|
|
remarkPlugins={[remarkGfm, remarkMath]}
|
|
rehypePlugins={[rehypeKatex]}
|
|
>
|
|
{children}
|
|
</ReactMarkdown>
|
|
);
|
|
};
|
|
|
|
export default Markdown;
|