Skip to content

Commit

Permalink
feature: Add github markdown support which includes tables, checklist…
Browse files Browse the repository at this point in the history
…s and auto links #300 (#302)

added the possibility to add checkboxes
  • Loading branch information
kamtschatka authored Jul 14, 2024
1 parent f77a41a commit 888dad6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Dialog, DialogContent } from "@/components/ui/dialog";
import Markdown from "react-markdown";
import remarkGfm from "remark-gfm";

export function BookmarkedTextViewer({
content,
Expand All @@ -13,7 +14,9 @@ export function BookmarkedTextViewer({
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent className="max-h-[75%] overflow-auto">
<Markdown className="prose">{content}</Markdown>
<Markdown remarkPlugins={[remarkGfm]} className="prose">
{content}
</Markdown>
</DialogContent>
</Dialog>
);
Expand Down
2 changes: 2 additions & 0 deletions apps/web/components/ui/markdown-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { cn } from "@/lib/utils";
import Markdown from "react-markdown";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { dracula } from "react-syntax-highlighter/dist/cjs/styles/prism";
import remarkGfm from "remark-gfm";

function PreWithCopyBtn({ className, ...props }: React.ComponentProps<"pre">) {
const ref = React.useRef<HTMLPreElement>(null);
Expand All @@ -27,6 +28,7 @@ export function MarkdownComponent({
}) {
return (
<Markdown
remarkPlugins={[remarkGfm]}
className="prose dark:prose-invert"
components={{
pre({ ...props }) {
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"react-masonry-css": "^1.0.16",
"react-select": "^5.8.0",
"react-syntax-highlighter": "^15.5.0",
"remark-gfm": "^4.0.0",
"sharp": "^0.33.3",
"superjson": "^2.2.1",
"tailwind-merge": "^2.2.1",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

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

0 comments on commit 888dad6

Please sign in to comment.