diff options
| author | kamtschatka <sschatka@gmail.com> | 2024-06-09 15:30:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-09 14:30:56 +0100 |
| commit | be1bb388924f4422058099dcb0debdd1c857d36a (patch) | |
| tree | bd518e1df0a137f88950b4f7f083da90e8e29cbb /apps/web/components/dashboard/bookmarks | |
| parent | f7a77533240ec435c8a7b103b6f6be409bf995d8 (diff) | |
| download | karakeep-be1bb388924f4422058099dcb0debdd1c857d36a.tar.zst | |
feature(web): Add syntax highlighting to code blocks and a quick copy button. Fixes #195 (#197)
* Any plans to support copy to clipboard (markdown code) for notes? #195
added a button to copy the markdown and added code highlighting
* Any plans to support copy to clipboard (markdown code) for notes? #195
Changed the copy-button to a generic one
added a safeguard and a message to the copy button if copying is not possible
* Some code cleanups
---------
Co-authored-by: kamtschatka <simon.schatka@gmx.at>
Co-authored-by: MohamedBassem <me@mbassem.com>
Diffstat (limited to 'apps/web/components/dashboard/bookmarks')
| -rw-r--r-- | apps/web/components/dashboard/bookmarks/TextCard.tsx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/apps/web/components/dashboard/bookmarks/TextCard.tsx b/apps/web/components/dashboard/bookmarks/TextCard.tsx index 74b3e8e5..b18efc3d 100644 --- a/apps/web/components/dashboard/bookmarks/TextCard.tsx +++ b/apps/web/components/dashboard/bookmarks/TextCard.tsx @@ -1,10 +1,10 @@ "use client"; import { useState } from "react"; +import { MarkdownComponent } from "@/components/ui/markdown-component"; import { api } from "@/lib/trpc"; import { bookmarkLayoutSwitch } from "@/lib/userLocalSettings/bookmarksLayout"; import { cn } from "@/lib/utils"; -import Markdown from "react-markdown"; import type { ZBookmark } from "@hoarder/shared/types/bookmarks"; import { isBookmarkStillTagging } from "@hoarder/shared-react/utils/bookmarkUtils"; @@ -52,11 +52,7 @@ export default function TextCard({ /> <BookmarkLayoutAdaptingCard title={bookmark.title} - content={ - <Markdown className="prose dark:prose-invert"> - {bookmarkedText.text} - </Markdown> - } + content={<MarkdownComponent>{bookmarkedText.text}</MarkdownComponent>} footer={null} wrapTags={true} bookmark={bookmark} |
