Skip to content

Commit

Permalink
fix: add link support for model markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Jul 17, 2024
1 parent 28a4ea5 commit 41fcb84
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app/dashboard/models/[modelId]/components/MarkdownRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import Markdown from 'react-markdown';
import { ReactNode } from 'react';
import { Link } from '@nextui-org/link';

export default function MarkdownRenderer({
children,
Expand All @@ -11,17 +12,24 @@ export default function MarkdownRenderer({
return (
<Markdown
components={{
a(props: any) {
return (
<Link href={props.href} isExternal>
{props.children}
</Link>
);
},
p({ children }) {
return <p className="mb-2 last:mb-0">{children}</p>;
},
h1({ children }) {
return <h1 className="text-bold text-2xl mb-4">{children}</h1>;
return <h1 className="text-bold mb-4 text-3xl">{children}</h1>;
},
h2({ children }) {
return <h2 className="text-bold text-xl mb-3">{children}</h2>;
return <h2 className="text-bold mb-3 text-2xl">{children}</h2>;
},
h3({ children }) {
return <h3 className="text-bold text-lg mb-2">{children}</h3>;
return <h3 className="text-bold mb-2 text-xl">{children}</h3>;
},
ol({ children }) {
return <ol className="list-inside list-decimal">{children}</ol>;
Expand Down

0 comments on commit 41fcb84

Please sign in to comment.