-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
286 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import Markdown from 'react-markdown' | ||
import remarkGfm from 'remark-gfm' | ||
|
||
const TailwindMarkdown: React.FC<{ content: string }> = ({ content }) => { | ||
return ( | ||
<Markdown | ||
className="prose prose-sm sm:prose lg:prose-lg xl:prose-xl" | ||
remarkPlugins={[remarkGfm]} | ||
components={{ | ||
h1: ({ node, ...props }) => ( | ||
<h1 className="text-2xl font-bold" {...props} /> | ||
), | ||
h2: ({ node, ...props }) => ( | ||
<h2 className="text-xl font-bold" {...props} /> | ||
), | ||
h3: ({ node, ...props }) => ( | ||
<h3 className="text-lg font-bold" {...props} /> | ||
), | ||
p: ({ node, ...props }) => <p className="m-0" {...props} />, | ||
a: ({ node, ...props }) => ( | ||
<a | ||
className="text-blue-500 hover:underline" | ||
target="_blank" | ||
{...props} | ||
/> | ||
), | ||
ul: ({ node, ...props }) => ( | ||
<ul className="list-disc list-inside" {...props} /> | ||
), | ||
ol: ({ node, ...props }) => ( | ||
<ol className="list-decimal list-inside" {...props} /> | ||
), | ||
blockquote: ({ node, ...props }) => ( | ||
<blockquote | ||
className="border-l-4 border-gray-300 pl-4 italic" | ||
{...props} | ||
/> | ||
), | ||
code: ({ node, ...props }) => ( | ||
<code className="bg-gray-100 p-1 rounded" {...props} /> | ||
) | ||
}} | ||
> | ||
{content} | ||
</Markdown> | ||
) | ||
} | ||
|
||
export default TailwindMarkdown |
Oops, something went wrong.