Absolutely! Here's a sample markdown content that includes:
- A heading
- Bold and italic text
- A link
- A code block with potentially dangerous code (like a ``Plain Text
πΌοΈ Example Image Tag (Should be escaped, not rendered)
HTML<img src="https://evil.com/malicious.png">
π Inline Code Example
Use the console.log("Hello World")
command to debug your JavaScript.
Thanks for reading!
Stay safe π¨βπ»π©βπ»
Plain TextYou can copy this markdown and use your render function with MarkdownIt + DOMPurify like we discussed:
ts const safeHTML = DOMPurify.sanitize(md.render(markdownContent));
Plain TextLet me know if you want this wrapped in a React component or Next.js preview page!
Share: