Skip to content

Commit

Permalink
Added support for markdown descriptions & removed linkify
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-dalby committed Dec 10, 2024
1 parent 1fbbf30 commit 20321d2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 40 deletions.
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"@monaco-editor/react": "^4.6.0",
"date-fns": "^4.1.0",
"framer-motion": "^11.11.9",
"linkify-react": "^4.1.3",
"lucide-react": "^0.452.0",
"monaco-editor": "^0.52.0",
"parse-duration": "^1.1.0",
Expand Down
9 changes: 4 additions & 5 deletions client/src/components/snippets/list/SnippetCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { ConfirmationModal } from '../../common/modals/ConfirmationModal';
import { Snippet } from '../../../types/snippets';
import CategoryList from '../../categories/CategoryList';
import { PreviewCodeBlock } from '../../editor/PreviewCodeBlock';
import Linkify from 'linkify-react';
import { linkifyOptions } from '../../../constants/linkify';
import ReactMarkdown from 'react-markdown';
import { formatDistanceToNow } from 'date-fns';
import { getUniqueLanguages } from '../../../utils/language/languageUtils';

Expand Down Expand Up @@ -174,10 +173,10 @@ export const SnippetCard: React.FC<SnippetCardProps> = ({
</div>

{!compactView && (
<p className="text-sm text-light-text dark:text-dark-text mb-3 line-clamp-2">
<Linkify options={linkifyOptions}>
<p className="text-sm text-light-text dark:text-dark-text mb-3 line-clamp-1">
<ReactMarkdown className={`markdown prose max-w-none`}>
{snippet.description || 'No description available'}
</Linkify>
</ReactMarkdown>
</p>
)}

Expand Down
7 changes: 3 additions & 4 deletions client/src/components/snippets/view/FullCodeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { Snippet } from '../../../types/snippets';
import CategoryList from '../../categories/CategoryList';
import { getLanguageLabel, getUniqueLanguages } from '../../../utils/language/languageUtils';
import { FullCodeBlock } from '../../editor/FullCodeBlock';
import Linkify from 'linkify-react';
import { linkifyOptions } from '../../../constants/linkify';
import ReactMarkdown from 'react-markdown';

interface FullCodeViewProps {
showTitle?: boolean;
Expand Down Expand Up @@ -73,9 +72,9 @@ export const FullCodeView: React.FC<FullCodeViewProps> = ({

{/* Description */}
<div className="text-sm text-light-text dark:text-dark-text mt-3">
<Linkify options={linkifyOptions}>
<ReactMarkdown className={`markdown prose max-w-none`}>
{snippet.description || 'No description available'}
</Linkify>
</ReactMarkdown>
</div>

{/* Categories */}
Expand Down
9 changes: 0 additions & 9 deletions client/src/constants/linkify.ts

This file was deleted.

24 changes: 3 additions & 21 deletions package-lock.json

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

0 comments on commit 20321d2

Please sign in to comment.