diff --git a/src/app/docs/[...categories]/page.jsx b/src/app/docs/[...categories]/page.jsx index f593270..9ec3440 100644 --- a/src/app/docs/[...categories]/page.jsx +++ b/src/app/docs/[...categories]/page.jsx @@ -3,6 +3,7 @@ import { join, sep } from 'path'; import { DOCS } from '@/constants/path'; import markdownToJsx, { readMarkdownWithFrontMatter } from '@/utils/markdownToJsx'; +import markdownToText from '@/utils/markdownToText'; /* Custom Declaration */ function getFilePath(params) { @@ -31,8 +32,8 @@ export async function generateMetadata({ params }) { } = await readMarkdownWithFrontMatter(getFilePath(params)); return { - title, - description, + title: markdownToText(title), + description: markdownToText(description), }; } diff --git a/src/utils/markdownToText.js b/src/utils/markdownToText.js new file mode 100644 index 0000000..b97ea5d --- /dev/null +++ b/src/utils/markdownToText.js @@ -0,0 +1,9 @@ +export default function markdownToText(markdown) { + return ( + markdown + // Inline Code Block(`) + .replace(/`(.+?)`/g, '$1') + // Italic(*), Bold(**), Italic & Bold(***) + .replace(/(\*{1,3})(\S)(.*?\S)??\1/g, '$2$3') + ); +}