I am using react markdown library. Here is my code:
import Markdown from 'react-markdown';
import PreClass from './PreClass';
type MarkdownFormatTextProps = {
markdown: string;
tagName?: string;
};
const MarkdownFormatText = ({ markdown, tagName }: MarkdownFormatTextProps) => {
return (
<article className=" prose prose-pre:w-[600px] prose-sm prose-ul:leading-[6px] prose-code:text-[15px] prose-blockquote:leading-[6px] prose-ol:leading-[6px] prose-p:leading-[20px] prose-li:relative prose-li:bottom-[-5px]">
{tagName && (
<span style={{ color: '#3297ff' }} className="cursor-pointer">
{tagName}
</span>
)}
<Markdown unwrapDisallowed children={markdown} skipHtml components={{ pre: PreClass }} />
</article>
);
};
export default MarkdownFormatText;
When I type in: ```hello
Then an error will be displayed.
Did you read the docs?
You need to add the import:
And use it in your component: