(props: {
inline?: boolean;
className?: string;
children?: React.ReactNode;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any; // Using any here as it's required for ReactMarkdown components
})
| 115 | return <td className="px-4 py-3 border-t border-gray-200 dark:border-gray-700" {...props}>{children}</td>; |
| 116 | }, |
| 117 | code(props: { |
| 118 | inline?: boolean; |
| 119 | className?: string; |
| 120 | children?: React.ReactNode; |
| 121 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 122 | [key: string]: any; // Using any here as it's required for ReactMarkdown components |
| 123 | }) { |
| 124 | const { inline, className, children, ...otherProps } = props; |
| 125 | const match = /language-(\w+)/.exec(className || ''); |
| 126 | const codeContent = children ? String(children).replace(/\n$/, '') : ''; |
| 127 | |
| 128 | // Handle Mermaid diagrams |
| 129 | if (!inline && match && match[1] === 'mermaid') { |
| 130 | return ( |
| 131 | <div className="my-8 bg-gray-50 dark:bg-gray-800 rounded-md overflow-hidden shadow-sm"> |
| 132 | <Mermaid |
| 133 | chart={codeContent} |
| 134 | className="w-full max-w-full" |
| 135 | zoomingEnabled={true} |
| 136 | /> |
| 137 | </div> |
| 138 | ); |
| 139 | } |
| 140 | |
| 141 | // Handle code blocks |
| 142 | if (!inline && match) { |
| 143 | return ( |
| 144 | <div className="my-6 rounded-md overflow-hidden text-sm shadow-sm"> |
| 145 | <div className="bg-gray-800 text-gray-200 px-5 py-2 text-sm flex justify-between items-center"> |
| 146 | <span>{match[1]}</span> |
| 147 | <button |
| 148 | onClick={() => { |
| 149 | navigator.clipboard.writeText(codeContent); |
| 150 | }} |
| 151 | className="text-gray-400 hover:text-white" |
| 152 | title="Copy code" |
| 153 | > |
| 154 | <svg |
| 155 | xmlns="http://www.w3.org/2000/svg" |
| 156 | className="h-5 w-5" |
| 157 | fill="none" |
| 158 | viewBox="0 0 24 24" |
| 159 | stroke="currentColor" |
| 160 | > |
| 161 | <path |
| 162 | strokeLinecap="round" |
| 163 | strokeLinejoin="round" |
| 164 | strokeWidth={2} |
| 165 | d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" |
| 166 | /> |
| 167 | </svg> |
| 168 | </button> |
| 169 | </div> |
| 170 | <SyntaxHighlighter |
| 171 | language={match[1]} |
| 172 | style={tomorrow} |
| 173 | className="!text-sm" |
| 174 | customStyle={{ margin: 0, borderRadius: '0 0 0.375rem 0.375rem', padding: '1rem' }} |
nothing calls this directly
no outgoing calls
no test coverage detected