import { jsx as _jsx } from "react/jsx-runtime";
import { useEffect, useState } from 'react';
/**
 * Rendered text as Markdown
 */
export function Markdown(props) {
    const { markdownParser, sanitizer, text } = props;
    const [renderedText, setRenderedText] = useState('');
    useEffect(() => {
        markdownParser.render(text).then(r => {
            if (sanitizer) {
                setRenderedText(sanitizer.sanitize(r));
            }
            else {
                setRenderedText(r);
            }
        });
    }, [markdownParser, sanitizer, text]);
    return _jsx("div", { dangerouslySetInnerHTML: { __html: renderedText } });
}
