Skip to content

Commit

Permalink
feat: add remark gfm for table nodes and more
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Jul 31, 2024
1 parent 2e70d05 commit fc825a7
Show file tree
Hide file tree
Showing 3 changed files with 282 additions and 1 deletion.
276 changes: 276 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"react-markdown": "^9.0.1",
"react-multi-email": "^1.0.23",
"recharts": "^2.12.7",
"remark-gfm": "^4.0.0",
"sharp": "^0.33.4",
"swr": "^2.2.5"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';

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

export default function MarkdownRenderer({
children,
Expand All @@ -11,6 +11,7 @@ export default function MarkdownRenderer({
}>) {
return (
<Markdown
remarkPlugins={[remarkGfm]}
components={{
a(props: any) {
return (
Expand Down Expand Up @@ -47,6 +48,9 @@ export default function MarkdownRenderer({
</blockquote>
);
},
table({ children }) {
return <table className="table-auto">{children}</table>;
},
}}
>
{children}
Expand Down

0 comments on commit fc825a7

Please sign in to comment.