Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/components/current/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ import ReactMarkdown from 'react-markdown';

//======================================
export const Markdown = ({ children }: { children: string }) => {
// regex to match URLs in text that arent already formatted as links in markdown
const urlRegex = /(?<!\]\()https?:\/\/[^\s]+(?!\))/g;

// add markdown syntax to format links in text if they aren't already marked
const processedText = children.replace(urlRegex, (url) => `[${url}](${url})`);

return (
<ReactMarkdown
components={{
Expand All @@ -19,7 +13,7 @@ export const Markdown = ({ children }: { children: string }) => {
code: (props) => <code className="text-orange-300" {...props} />,
}}
>
{processedText}
{children}
</ReactMarkdown>
);
};