Both the useRemark hook and the <Remark> component accept an options object to configure the underlying unified/remark/rehype pipeline.
Available configuration keys:
remarkParseOptions (Object): Configure how Markdown is parsed (matches remark-parse options).remarkPlugins (Array): Remark plugins or custom plugins to transform markdown content (mdast) before translation to HTML.remarkToRehypeOptions (Object): Configure how Markdown (mdast) is translated into HTML (hast) (matches remark-rehype options).rehypePlugins (Array): Rehype plugins or custom plugins to transform HTML (hast) before translation to React elements.rehypeReactOptions (Object): Configure how HTML (hast) is translated into React elements (matches rehype-react options).
import { useRemark } from 'react-remark';
import remarkGemoji from 'remark-gemoji';
import rehypeSlug from 'rehype-slug';
import rehypeAutoLinkHeadings from 'rehype-autolink-headings';
const [reactContent, setMarkdownSource] = useRemark({
remarkPlugins: [remarkGemoji],
remarkToRehypeOptions: { allowDangerousHtml: true },
rehypePlugins: [rehypeSlug, rehypeAutoLinkHeadings],
rehypeReactOptions: {
components: {
p: (props) => <p className="custom-paragraph" {...props} />,
},
},
});