diff --git a/src/components/SanitizedHTML/index.tsx b/src/components/SanitizedHTML/index.tsx index 45d1066..5565285 100644 --- a/src/components/SanitizedHTML/index.tsx +++ b/src/components/SanitizedHTML/index.tsx @@ -5,6 +5,13 @@ type Props = { }; const SanitizedHTML: React.FC = ({dirtyHTML}: Props) => { + DOMPurify.addHook("afterSanitizeAttributes", function (node) { + if ("target" in node) { + node.setAttribute("target", "_blank"); + node.setAttribute("rel", "noreferrer noopener nofollow"); + } + }); + const sanitized = DOMPurify.sanitize(dirtyHTML); return
;