fix: AI对话中的链接应该在浏览器中打开(resolve #150)

This commit is contained in:
digua authored and digua committed 2026-04-24 22:33:56 +08:00
1 parent 68e7285570
commit 071a8dbb2f
1 file changed
+6
@@ -38,6 +38,12 @@ const md = new MarkdownIt({
typographer: true, // 启用排版优化
})
md.renderer.rules.link_open = (tokens, idx, options, _env, self) => {
tokens[idx].attrSet('target', '_blank')
tokens[idx].attrSet('rel', 'noopener noreferrer')
return self.renderToken(tokens, idx, options)
}
// 渲染 Markdown 文本
function renderMarkdown(text: string): string {
if (!text) return ''