| 25 | import { IconInfoCircle } from '../ui/icons/info'; |
| 26 | |
| 27 | export const MarkdownComponents = () => { |
| 28 | return { |
| 29 | a: (props: any) => { |
| 30 | // Check if the link is external |
| 31 | const isExternal = props.href.startsWith('http'); |
| 32 | |
| 33 | // Open external links in new tab |
| 34 | if (isExternal) { |
| 35 | return ( |
| 36 | <a |
| 37 | {...props} |
| 38 | target="_blank" |
| 39 | rel="noopener noreferrer" |
| 40 | className="text-indigo-400" |
| 41 | /> |
| 42 | ); |
| 43 | } |
| 44 | return <Link {...props} className="text-indigo-400" />; |
| 45 | }, |
| 46 | Img: (props: any) => { |
| 47 | return <Image {...props} />; |
| 48 | }, |
| 49 | img: (props: any) => { |
| 50 | return <Image {...props} />; |
| 51 | }, |
| 52 | hr: (props: any) => { |
| 53 | return ( |
| 54 | <hr |
| 55 | className="my-12 h-[3px] w-full border-0 border-b-[2px] border-border bg-background" |
| 56 | {...props} |
| 57 | /> |
| 58 | ); |
| 59 | }, |
| 60 | table: (props: any) => { |
| 61 | return ( |
| 62 | <div className='overflow-x-scroll'> |
| 63 | <table |
| 64 | className="whitespace-nowrap" |
| 65 | {...props} |
| 66 | /> |
| 67 | </div> |
| 68 | ); |
| 69 | }, |
| 70 | h2: (props: any) => { |
| 71 | return <HeadingComp level={2} {...props} />; |
| 72 | }, |
| 73 | Heading: (props: any) => { |
| 74 | return <HeadingComp {...props} />; |
| 75 | }, |
| 76 | DesktopOnly: (props: any) => { |
| 77 | return <div className="hidden xl:block" {...props} />; |
| 78 | }, |
| 79 | CodeExamples: (props: any) => { |
| 80 | return <CodeExamples {...props} />; |
| 81 | }, |
| 82 | LbLogo: (props: any) => { |
| 83 | return <LbLogo {...props} />; |
| 84 | }, |