Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions source/ui-chat/src/components/markdown/MarkdownContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ const MARKDOWN_COMPONENTS: Components = {
*/
td({ children }) {
return <td className="markdown-td">{children}</td>;
},
/**
* Renders links with external links opening in new tabs
*/
a({ href, children, ...props }) {
const isExternal = href && (href.startsWith('http://') || href.startsWith('https://'));

return (
<a
href={href}
target={isExternal ? '_blank' : undefined}
rel={isExternal ? 'noopener noreferrer' : undefined}
{...props}
>
{children}
</a>
);
}
};

Expand Down