11import { PageBase } from "web/components/page-base" ;
22import { Col } from "web/components/layout/col" ;
33import ReactMarkdown from "react-markdown" ;
4-
5- import Link from "next/link" ;
64import { SEO } from "web/components/SEO" ;
75import { capitalize } from "lodash" ;
6+ import { CustomLink } from "web/components/links" ;
87
98type Props = {
109 content : string ;
1110 filename : string ;
1211} ;
1312
14- const MarkdownLink = ( { href, children} : { href ?: string ; children : React . ReactNode } ) => {
15- if ( ! href ) return < > { children } </ >
16-
17- // If href is internal, use Next.js Link
18- if ( href . startsWith ( '/' ) ) {
19- return < Link href = { href } > { children } </ Link >
20- }
21-
22- // For external links, fall back to <a>
23- return (
24- < a href = { href } target = "_blank" rel = "noopener noreferrer" >
25- { children }
26- </ a >
27- )
28- }
29-
30- export const CompassMarkdown = ( { children} : { children : string } ) => {
13+ export const CustomMarkdown = ( { children} : { children : string } ) => {
3114 return < ReactMarkdown
3215 components = { {
33- a : ( { node : _node , children, ...props } ) => < MarkdownLink { ...props } > { children } </ MarkdownLink >
16+ a : ( { node : _node , children, ...props } ) => < CustomLink { ...props } > { children } </ CustomLink >
3417 } }
3518 >
3619 { children }
@@ -48,7 +31,7 @@ export default function MarkdownPage({content, filename}: Props) {
4831 />
4932 < Col className = "items-center mb-8" >
5033 < Col className = 'w-full rounded px-3 py-4 sm:px-6 space-y-4 custom-link' >
51- < CompassMarkdown > { content } </ CompassMarkdown >
34+ < CustomMarkdown > { content } </ CustomMarkdown >
5235 </ Col >
5336 </ Col >
5437 </ PageBase >
0 commit comments