markdown에 iframe 동영상 적용하기
npm install rehype-raw
npm install rehype-sanitizeimport ReactMarkdown from 'react-markdown';
import rehypeRaw from 'rehype-raw';
import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';<ReactMarkdown
rehypePlugins={[
rehypeRaw,
rehypeSanitize({
...defaultSchema,
attributes: {
...defaultSchema.attributes,
iframe: [...(defaultSchema.attributes.iframe || [])],
},
}),
]}
>
{content}
</ReactMarkdown>Last updated