Allow line breaks for <a> tags

This commit is contained in:
Umihiko Iwasa 2024-07-07 11:29:07 +09:00 committed by GitHub
parent a2fde6dc7e
commit bbe62ea0b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,14 +8,14 @@ const CustomLink = ({ href, ...rest }: LinkProps & AnchorHTMLAttributes<HTMLAnch
const isAnchorLink = href && href.startsWith('#')
if (isInternalLink) {
return <Link href={href} {...rest} />
return <Link className="break-words" href={href} {...rest} />
}
if (isAnchorLink) {
return <a href={href} {...rest} />
return <a className="break-words" href={href} {...rest} />
}
return <a target="_blank" rel="noopener noreferrer" href={href} {...rest} />
return <a className="break-words" target="_blank" rel="noopener noreferrer" href={href} {...rest} />
}
export default CustomLink