import React from 'react';
import MarkdownPreview from 'react-markdown';
import { componentsRegistry } from '@digigov/ui/content/SafeHTML';

export const Markdown = ({
  content,
  children,
  ...props
}: {
  content?: string;
  children?: string;
}) => {
  children = content || children || '';

  return (
    <MarkdownPreview components={componentsRegistry as any} {...props}>
      {children}
    </MarkdownPreview>
  );
};

export default Markdown;
