diff --git a/src/content/docs/zh-cn/guides/rss.mdx b/src/content/docs/zh-cn/guides/rss.mdx index 46a54894d167e..8edf47d0fe887 100644 --- a/src/content/docs/zh-cn/guides/rss.mdx +++ b/src/content/docs/zh-cn/guides/rss.mdx @@ -165,6 +165,7 @@ items: import.meta.glob('./blog/*.{md,mdx}'), ::: 当使用内容集合时,使用标准的 Markdown 解析器如 [`markdown-it`](https://github.com/markdown-it/markdown-it) 渲染文章 `body` 并清理结果: +在使用内容集合时,使用标准的 Markdown 解析器如 [`markdown-it`](https://github.com/markdown-it/markdown-it) 渲染文章 `body` 并清理结果,包括渲染内容所需的任何额外标签(例如 ``): ```js title="src/pages/rss.xml.js" ins={3, 4, 5, 16} import rss from '@astrojs/rss'; @@ -182,7 +183,9 @@ export async function GET(context) { items: blog.map((post) => ({ link: `/blog/${post.slug}/`, // 注意:这不会处理 MDX 文件中的组件或 JSX 表达式。 - content: sanitizeHtml(parser.render(post.body)), + content: sanitizeHtml(parser.render(post.body), { + allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']) + }), ...post.data, })), });