Skip to content

Commit

Permalink
Opti. 优化RSS内容格式
Browse files Browse the repository at this point in the history
  • Loading branch information
RavelloH authored Oct 29, 2024
1 parent d9f7d32 commit 248a71d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/feed.xml/route.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import RSS from 'rss';
import config from '../../../config';
import getDB from '@/utils/db';
import Shiki from '@shikijs/markdown-it';
import MarkdownIt from 'markdown-it';

const md = MarkdownIt({ html: true });
md.use(
await Shiki({
themes: {
light: 'dark-plus',
dark: 'dark-plus',
},
}),
);

const category = await getDB('category');
const categories = [];
Expand Down Expand Up @@ -34,7 +46,7 @@ export async function GET() {
title: post.title,
guid: post.id,
url: `${config.siteName}posts/${post.name}`,
description: post.content,
description: md.render(post.content),
date: new Date(post.createdAt),
});
});
Expand Down

0 comments on commit 248a71d

Please sign in to comment.