diff --git a/web/components/links.tsx b/web/components/links.tsx new file mode 100644 index 00000000..313c1c84 --- /dev/null +++ b/web/components/links.tsx @@ -0,0 +1,17 @@ +import Link from "next/link"; + +export const CustomLink = ({href, children}: { href?: string; children: React.ReactNode }) => { + if (!href) return <>{children} + + // If href is internal, use Next.js Link + if (href.startsWith('/')) { + return {children} + } + + // For external links, fall back to + return ( + + {children} + + ) +} \ No newline at end of file diff --git a/web/components/markdown.tsx b/web/components/markdown.tsx index 18b01a0e..b0adac3a 100644 --- a/web/components/markdown.tsx +++ b/web/components/markdown.tsx @@ -1,36 +1,19 @@ import {PageBase} from "web/components/page-base"; import {Col} from "web/components/layout/col"; import ReactMarkdown from "react-markdown"; - -import Link from "next/link"; import {SEO} from "web/components/SEO"; import {capitalize} from "lodash"; +import {CustomLink} from "web/components/links"; type Props = { content: string; filename: string; }; -const MarkdownLink = ({href, children}: { href?: string; children: React.ReactNode }) => { - if (!href) return <>{children} - - // If href is internal, use Next.js Link - if (href.startsWith('/')) { - return {children} - } - - // For external links, fall back to - return ( - - {children} - - ) -} - -export const CompassMarkdown = ({children}: { children: string }) => { +export const CustomMarkdown = ({children}: { children: string }) => { return {children} + a: ({node: _node, children, ...props}) => {children} }} > {children} @@ -48,7 +31,7 @@ export default function MarkdownPage({content, filename}: Props) { /> - {content} + {content} diff --git a/web/pages/news.tsx b/web/pages/news.tsx index d93d74ad..18d857ae 100644 --- a/web/pages/news.tsx +++ b/web/pages/news.tsx @@ -4,10 +4,10 @@ import {PageBase} from "web/components/page-base" import {SEO} from "web/components/SEO" import {Col} from "web/components/layout/col" import {Title} from "web/components/widgets/title" -import Link from "next/link" import {CompassLoadingIndicator} from "web/components/widgets/loading-indicator" import {githubRepoSlug} from "common/constants"; -import {CompassMarkdown} from "web/components/markdown"; +import {CustomMarkdown} from "web/components/markdown"; +import {CustomLink} from "web/components/links"; type Release = { id: number @@ -66,11 +66,11 @@ export default function WhatsNew() {
- + {formatPullLinks(release.body || "_No release notes provided._")} - +
- View on GitHub + View on GitHub ))}