mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
fix: AI对话中的链接应该在浏览器中打开(resolve #150)
This commit is contained in:
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 ''
|
||||
|
||||
Reference in new issue
Block a user