Marked.tsx 517 B

12345678910111213141516171819202122232425
  1. import { Typography } from "antd";
  2. import { marked } from "marked";
  3. const { Text } = Typography;
  4. interface IWidget {
  5. text?: string;
  6. style?: React.CSSProperties;
  7. className?: string;
  8. }
  9. const MarkedWidget = ({ text, style, className }: IWidget) => {
  10. return (
  11. <Text className={className}>
  12. <div
  13. style={style}
  14. className={className}
  15. dangerouslySetInnerHTML={{
  16. __html: marked.parse(text ? text : ""),
  17. }}
  18. />
  19. </Text>
  20. );
  21. };
  22. export default MarkedWidget;