From b72fbb501fdeda77222228ada30cd0b84b4adcf1 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 8 Dec 2022 18:56:39 +0000 Subject: [PATCH] feat: use rehype-infer-description-meta to get excerpt --- showcase.json | 3 ++- src/components/site/SiteHome.tsx | 2 +- src/markdown/index.ts | 6 +++--- src/markdown/remark-excerpt.ts | 19 ------------------- tailwind.config.js | 2 +- 5 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 src/markdown/remark-excerpt.ts diff --git a/showcase.json b/showcase.json index 1a3480ee79..4bea7e71f7 100644 --- a/showcase.json +++ b/showcase.json @@ -56,5 +56,6 @@ "henryq", "duoyu", "candinya", - "shang" + "shang", + "v1984" ] diff --git a/src/components/site/SiteHome.tsx b/src/components/site/SiteHome.tsx index 58ec7a2cbb..4fbfe821ab 100644 --- a/src/components/site/SiteHome.tsx +++ b/src/components/site/SiteHome.tsx @@ -81,7 +81,7 @@ export const SiteHome: React.FC<{
, Root> = - ({ env }) => - (tree) => { - for (const node of tree.children) { - if (node.type === "paragraph") { - env.excerpt = mdAstToString(node, { - includeImageAlt: false, - }).slice(0, 140) - if (env.excerpt) { - break - } - } - } - } diff --git a/tailwind.config.js b/tailwind.config.js index 59150367db..75d59bb3cb 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -22,5 +22,5 @@ module.exports = { }, }, variants: {}, - plugins: [], + plugins: [require("@tailwindcss/line-clamp")], }