Merge pull request #668 from wanderer-industries/feature-description-link

fix(map): Fixed links in Description - now it opens sites in new tab
This commit is contained in:
Aleksei Chichenkov authored and GitHub committed 2026-09-11 14:29:15 +03:00
commit 3390a43eba
1 file changed
+15 -3
@@ -1,4 +1,4 @@
import Markdown from 'react-markdown';
import Markdown, { type Components } from 'react-markdown';
import remarkGfm from 'remark-gfm';
import remarkBreaks from 'remark-breaks';
@@ -6,12 +6,24 @@ import classes from './MarkdownTextViewer.module.scss';
const REMARK_PLUGINS = [remarkGfm, remarkBreaks];
type MarkdownTextViewerProps = { children: string };
const MARKDOWN_COMPONENTS: Components = {
a: ({ node, ...props }) => {
void node;
return <a {...props} target="_blank" rel="noopener noreferrer" />;
},
};
export interface MarkdownTextViewerProps {
children: string;
}
export const MarkdownTextViewer = ({ children }: MarkdownTextViewerProps) => {
return (
<div className={classes.MarkdownTextViewer}>
<Markdown remarkPlugins={REMARK_PLUGINS}>{children}</Markdown>
<Markdown components={MARKDOWN_COMPONENTS} remarkPlugins={REMARK_PLUGINS}>
{children}
</Markdown>
</div>
);
};