This commit is contained in:
phact 2025-09-16 12:38:51 -04:00
parent f9e363b2fb
commit bac1c24a9c
3 changed files with 22 additions and 11 deletions

View file

@ -64,31 +64,31 @@ export const MarkdownRenderer = ({ chatMessage }: MarkdownRendererProps) => {
rehypePlugins={[rehypeMathjax, rehypeRaw]} rehypePlugins={[rehypeMathjax, rehypeRaw]}
linkTarget="_blank" linkTarget="_blank"
components={{ components={{
p({ node, ...props }) { p: ({ node, ...props }: any) => {
return <p className="w-fit max-w-full">{props.children}</p>; return <p className="w-fit max-w-full">{props.children}</p>;
}, },
ol({ node, ...props }) { ol: ({ node, ...props }: any) => {
return <ol className="max-w-full">{props.children}</ol>; return <ol className="max-w-full">{props.children}</ol>;
}, },
h1({ node, ...props }) { h1: ({ node, ...props }: any) => {
return <h1 className="mb-6 mt-4">{props.children}</h1>; return <h1 className="mb-6 mt-4">{props.children}</h1>;
}, },
h2({ node, ...props }) { h2: ({ node, ...props }: any) => {
return <h2 className="mb-4 mt-4">{props.children}</h2>; return <h2 className="mb-4 mt-4">{props.children}</h2>;
}, },
h3({ node, ...props }) { h3: ({ node, ...props }: any) => {
return <h3 className="mb-2 mt-4">{props.children}</h3>; return <h3 className="mb-2 mt-4">{props.children}</h3>;
}, },
hr({ node, ...props }) { hr: ({ node, ...props }: any) => {
return <hr className="w-full mt-4 mb-8" />; return <hr className="w-full mt-4 mb-8" />;
}, },
ul({ node, ...props }) { ul: ({ node, ...props }: any) => {
return <ul className="max-w-full mb-2">{props.children}</ul>; return <ul className="max-w-full mb-2">{props.children}</ul>;
}, },
pre({ node, ...props }) { pre: ({ node, ...props }: any) => {
return <>{props.children}</>; return <>{props.children}</>;
}, },
table: ({ node, ...props }) => { table: ({ node, ...props }: any) => {
return ( return (
<div className="max-w-full overflow-hidden rounded-md border bg-muted"> <div className="max-w-full overflow-hidden rounded-md border bg-muted">
<div className="max-h-[600px] w-full overflow-auto p-4"> <div className="max-h-[600px] w-full overflow-auto p-4">
@ -98,7 +98,7 @@ export const MarkdownRenderer = ({ chatMessage }: MarkdownRendererProps) => {
); );
}, },
code: ({ node, className, inline, children, ...props }) => { code: ({ node, className, inline, children, ...props }: any) => {
let content = children as string; let content = children as string;
if ( if (
Array.isArray(children) && Array.isArray(children) &&

View file

@ -12,6 +12,7 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"jsxImportSource": "react",
"incremental": true, "incremental": true,
"plugins": [ "plugins": [
{ {
@ -22,6 +23,6 @@
"@/*": ["./src/*", "./*"] "@/*": ["./src/*", "./*"]
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": ["next-env.d.ts", "types/**/*.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }

10
frontend/types/global.d.ts vendored Normal file
View file

@ -0,0 +1,10 @@
/// <reference types="react" />
/// <reference types="react-dom" />
declare global {
namespace JSX {
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
}
}
export {};