Skip to content

Commit d59e6e0

Browse files
committed
Fix news link (open in no tab)
1 parent 7ec6866 commit d59e6e0

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

web/components/markdown.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ const MarkdownLink = ({href, children}: { href?: string; children: React.ReactNo
2727
)
2828
}
2929

30+
export const CompassMarkdown = ({children}: { children: string }) => {
31+
return <ReactMarkdown
32+
components={{
33+
a: ({node: _node, children, ...props}) => <MarkdownLink {...props}>{children}</MarkdownLink>
34+
}}
35+
>
36+
{children}
37+
</ReactMarkdown>
38+
}
39+
3040
export default function MarkdownPage({content, filename}: Props) {
3141
const title = /[A-Z]/.test(filename) ? filename : capitalize(filename)
3242
return (
@@ -38,12 +48,7 @@ export default function MarkdownPage({content, filename}: Props) {
3848
/>
3949
<Col className="items-center mb-8">
4050
<Col className='w-full rounded px-3 py-4 sm:px-6 space-y-4 custom-link'>
41-
<ReactMarkdown
42-
components={{
43-
a: ({node: _node, children, ...props}) => <MarkdownLink {...props}>{children}</MarkdownLink>
44-
}}
45-
>{content}
46-
</ReactMarkdown>
51+
<CompassMarkdown>{content}</CompassMarkdown>
4752
</Col>
4853
</Col>
4954
</PageBase>

web/pages/news.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {useEffect, useState} from "react"
22
import axios from "axios"
3-
import ReactMarkdown from "react-markdown"
43
import {PageBase} from "web/components/page-base"
54
import {SEO} from "web/components/SEO"
65
import {Col} from "web/components/layout/col"
76
import {Title} from "web/components/widgets/title"
87
import Link from "next/link"
98
import {CompassLoadingIndicator} from "web/components/widgets/loading-indicator"
109
import {githubRepoSlug} from "common/constants";
10+
import {CompassMarkdown} from "web/components/markdown";
1111

1212
type Release = {
1313
id: number
@@ -66,9 +66,9 @@ export default function WhatsNew() {
6666
</span>
6767
</div>
6868
<div className="mt-4 mb-4 prose prose-neutral dark:prose-invert text-ink-1000">
69-
<ReactMarkdown>
69+
<CompassMarkdown>
7070
{formatPullLinks(release.body || "_No release notes provided._")}
71-
</ReactMarkdown>
71+
</CompassMarkdown>
7272
</div>
7373
<Link href={release.html_url}>View on GitHub</Link>
7474
</div>
@@ -83,8 +83,8 @@ function formatPullLinks(text = "") {
8383
return text
8484
.replace('CompassMeet', 'CompassConnections')
8585
.replace(
86-
/https:\/\/github\.com\/CompassConnections\/Compass\/pull\/(\d+)/g,
87-
(_, num) => `[#${num}](https://github.com/CompassConnections/Compass/pull/${num})`)
86+
/https:\/\/github\.com\/CompassConnections\/Compass\/pull\/(\d+)/g,
87+
(_, num) => `[#${num}](https://github.com/CompassConnections/Compass/pull/${num})`)
8888
.replace(
8989
/\**Full Changelog\**: https:\/\/github\.com\/CompassConnections\/Compass\/compare\/([\w.-]+\.\.\.[\w.-]+)/g,
9090
'')

0 commit comments

Comments
 (0)