@@ -15,12 +15,12 @@ import type { MDXComponents } from "mdx/types";
1515import muiComponents from "mui-mdx-components" ;
1616import * as React from "react" ;
1717import * as runtime from "react/jsx-runtime" ;
18- import { Link } from "react-router-dom" ;
1918import remarkGfm from "remark-gfm" ;
2019import * as R from "remeda" ;
2120
2221import Hooks from "../hooks" ;
2322import { ErrorFallback } from "./error_handler" ;
23+ import { LinkHandler } from "./link_handler" ;
2424import { rtrim } from "../utils/string" ;
2525import { StyledDivider } from "./mdx_components/styled_divider" ;
2626import { SubContentContainer } from "./mdx_components/sub_content_container" ;
@@ -47,16 +47,6 @@ const REGISTERED_KEYWORDS = [
4747 "}" ,
4848] ;
4949
50- const EXTERNAL_PROTOCOLS = [ "http://" , "https://" , "mailto:" , "tel:" ] ;
51-
52- const LinkHandler : React . FC < { href : string } > = ( { href, ...props } ) => {
53- // If the href starts with "http" or "https", it's an external link
54- if ( EXTERNAL_PROTOCOLS . some ( ( protocol ) => href . startsWith ( protocol ) ) )
55- return < a href = { href } target = "_blank" rel = "noopener noreferrer" { ...props } /> ;
56-
57- return < Link to = { href } { ...props } /> ;
58- } ;
59-
6050const CustomMDXComponents : MDXComponents = {
6151 h1 : ( props ) => < h1 style = { { margin : 0 } } { ...props } /> ,
6252 h2 : ( props ) => < h2 style = { { margin : 0 } } { ...props } /> ,
0 commit comments