Compare commits
2 Commits
e78bc12c49
...
dd4f848071
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd4f848071 | ||
|
|
46097b8390 |
@@ -17,8 +17,8 @@ import smartypants from "remark-smartypants";
|
|||||||
import rehypeRaw from "rehype-raw";
|
import rehypeRaw from "rehype-raw";
|
||||||
import emoji from "remark-emoji";
|
import emoji from "remark-emoji";
|
||||||
import oembed from "@agentofuser/remark-oembed";
|
import oembed from "@agentofuser/remark-oembed";
|
||||||
import remarkDirective from 'remark-directive'
|
import remarkDirective from "remark-directive";
|
||||||
import remarkDirectiveRehype from 'remark-directive-rehype'
|
import remarkDirectiveRehype from "remark-directive-rehype";
|
||||||
import { YouTubeVideo } from "./Youtube";
|
import { YouTubeVideo } from "./Youtube";
|
||||||
import { ImageSlide } from "./ImageSlide";
|
import { ImageSlide } from "./ImageSlide";
|
||||||
//import rehypeSanitize from "rehype-sanitize";
|
//import rehypeSanitize from "rehype-sanitize";
|
||||||
@@ -30,7 +30,6 @@ SyntaxHighlighter.registerLanguage("bash", bash);
|
|||||||
SyntaxHighlighter.registerLanguage("markdown", markdown);
|
SyntaxHighlighter.registerLanguage("markdown", markdown);
|
||||||
SyntaxHighlighter.registerLanguage("json", json);
|
SyntaxHighlighter.registerLanguage("json", json);
|
||||||
|
|
||||||
|
|
||||||
export const StyledMarkdown = ({ html }: { html: string }) => {
|
export const StyledMarkdown = ({ html }: { html: string }) => {
|
||||||
const MarkdownComponents: Components = {
|
const MarkdownComponents: Components = {
|
||||||
h1: (props: any) => {
|
h1: (props: any) => {
|
||||||
@@ -110,11 +109,9 @@ export const StyledMarkdown = ({ html }: { html: string }) => {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
code({ node, inline, className, ...props }: any) {
|
code({ node, inline, className, ...props }: any) {
|
||||||
|
|
||||||
const match = /language-(\w+)/.exec(className || "");
|
const match = /language-(\w+)/.exec(className || "");
|
||||||
const hasMeta = node?.data?.meta;
|
const hasMeta = node?.data?.meta;
|
||||||
|
|
||||||
|
|
||||||
const applyHighlights: object = (applyHighlights: number) => {
|
const applyHighlights: object = (applyHighlights: number) => {
|
||||||
if (hasMeta) {
|
if (hasMeta) {
|
||||||
const RE = /{([\d,-]+)}/;
|
const RE = /{([\d,-]+)}/;
|
||||||
@@ -154,7 +151,6 @@ export const StyledMarkdown = ({ html }: { html: string }) => {
|
|||||||
return "Code";
|
return "Code";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return match ? (
|
return match ? (
|
||||||
<div>
|
<div>
|
||||||
<div className="w-full flex flex-row items-center gap-4">
|
<div className="w-full flex flex-row items-center gap-4">
|
||||||
@@ -185,18 +181,18 @@ export const StyledMarkdown = ({ html }: { html: string }) => {
|
|||||||
},
|
},
|
||||||
//custom directives
|
//custom directives
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
'yt': YouTubeVideo,
|
yt: YouTubeVideo,
|
||||||
'img-slide': ImageSlide,
|
"img-slide": ImageSlide,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="
|
className="
|
||||||
prose
|
prose
|
||||||
prose-code:font-mono prose-code:text-gray-100 prose-code:bg-gray-700 prose-code:p-1 prose-code:m-1 prose-code:rounded-md
|
prose-code:font-mono prose-code:text-gray-100 prose-code:bg-black/20 prose-code:p-1 prose-code:m-1 prose-code:rounded-md
|
||||||
prose-headings:text-gray-800 dark:prose-headings:text-gray-100 prose-p:text-gray-600 dark:prose-p:text-gray-300
|
prose-headings:text-gray-800 dark:prose-headings:text-gray-100 prose-p:text-gray-600 dark:prose-p:text-gray-300
|
||||||
prose-img:w-full prose-img:h-auto prose-img:object-cover
|
prose-img:w-full prose-img:h-auto prose-img:object-cover
|
||||||
prose-li:text-gray-600 dark:prose-li:text-gray-300 prose-td:text-gray-600 dark:prose-td:text-gray-400
|
prose-li:text-gray-600 dark:prose-li:text-gray-200 prose-td:text-gray-600 dark:prose-td:text-gray-300
|
||||||
prose-a:text-primary prose-strong:text-gray-900 dark:prose-strong:text-gray-50
|
prose-a:text-primary prose-strong:text-gray-900 dark:prose-strong:text-gray-50
|
||||||
dark:prose-hr:bg-gray-200 prose-hr:bg-gray-400
|
dark:prose-hr:bg-gray-200 prose-hr:bg-gray-400
|
||||||
"
|
"
|
||||||
@@ -204,7 +200,15 @@ export const StyledMarkdown = ({ html }: { html: string }) => {
|
|||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
components={MarkdownComponents}
|
components={MarkdownComponents}
|
||||||
rehypePlugins={[rehypeRaw]}
|
rehypePlugins={[rehypeRaw]}
|
||||||
remarkPlugins={[remarkDirective, remarkDirectiveRehype, oembed, remarkGfm, smartypants, emoji, remarkTypograf]}
|
remarkPlugins={[
|
||||||
|
remarkDirective,
|
||||||
|
remarkDirectiveRehype,
|
||||||
|
oembed,
|
||||||
|
remarkGfm,
|
||||||
|
smartypants,
|
||||||
|
emoji,
|
||||||
|
remarkTypograf,
|
||||||
|
]}
|
||||||
children={html}
|
children={html}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const Blog = ({ posts }: { posts: Post[] }) => {
|
|||||||
<h1 className="text-3xl font-bold text-gray-800 dark:text-gray-200">
|
<h1 className="text-3xl font-bold text-gray-800 dark:text-gray-200">
|
||||||
Blog
|
Blog
|
||||||
</h1>
|
</h1>
|
||||||
<div className="w-full h-0.5 bg-violet-200 dark:bg-violet-700 my-4 rounded-full" />
|
<div className="w-full h-0.5 bg-violet-200 dark:bg-white/20 my-4 rounded-full" />
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
{posts.map((post, index) => (
|
{posts.map((post, index) => (
|
||||||
<BlogCard
|
<BlogCard
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const Projects = ({ posts }: { posts: Post[] }) => {
|
|||||||
<h1 className="text-3xl font-bold text-gray-800 dark:text-gray-100">
|
<h1 className="text-3xl font-bold text-gray-800 dark:text-gray-100">
|
||||||
Projects
|
Projects
|
||||||
</h1>
|
</h1>
|
||||||
<div className="w-full h-0.5 bg-violet-200 dark:bg-violet-700 my-4 rounded-full" />
|
<div className="w-full h-0.5 bg-violet-200 dark:bg-white/20 my-4 rounded-full" />
|
||||||
<div className="grid grid-cols-1 gap-4">
|
<div className="grid grid-cols-1 gap-4">
|
||||||
{posts.map((post, index) => (
|
{posts.map((post, index) => (
|
||||||
<ProjectCard
|
<ProjectCard
|
||||||
|
|||||||
@@ -19,15 +19,15 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
@apply dark:bg-slate-800 bg-slate-200 text-slate-800 dark:text-slate-200 !important;
|
@apply dark:bg-black/30 bg-slate-200 text-slate-800 dark:text-slate-200 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre > code {
|
pre > code {
|
||||||
@apply bg-transparent text-gray-700 dark:text-slate-300 !important;
|
@apply bg-transparent text-gray-700 dark:text-slate-300 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.codeStyle > code {
|
.codeStyle {
|
||||||
background: transparent;
|
@apply bg-transparent !important
|
||||||
}
|
}
|
||||||
|
|
||||||
pre > div > div > button > svg:hover {
|
pre > div > div > button > svg:hover {
|
||||||
@@ -42,9 +42,22 @@ h1 > a:hover::before,
|
|||||||
h2 > a:hover::before,
|
h2 > a:hover::before,
|
||||||
h3 > a:hover::before,
|
h3 > a:hover::before,
|
||||||
h4 > a:hover::before {
|
h4 > a:hover::before {
|
||||||
@apply content-['#'] absolute -left-8 text-gray-300 dark:text-gray-600;
|
@apply content-['#'] absolute -left-8 text-gray-300 dark:text-gray-400;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2 > a:hover::before {
|
||||||
|
@apply -left-6;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 > a:hover::before {
|
||||||
|
@apply -left-5;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 > a:hover::before {
|
||||||
|
@apply -left-4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
div > code, pre > code {
|
div > code, pre > code {
|
||||||
@apply p-0 m-0 !important
|
@apply p-0 m-0 !important
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user