Skip to content

Commit d422a80

Browse files
committed
feat: 渲染的链接新窗口打开
1 parent 08b5772 commit d422a80

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"linkify",
3838
"logprobs",
3939
"mdhljs",
40+
"mila",
4041
"nodata",
4142
"OPENAI",
4243
"pinia",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@types/crypto-js": "^4.1.1",
4444
"@types/katex": "^0.16.0",
4545
"@types/markdown-it": "^12.2.3",
46+
"@types/markdown-it-link-attributes": "^3.0.1",
4647
"@types/node": "^18.14.6",
4748
"@vitejs/plugin-vue": "^4.0.0",
4849
"autoprefixer": "^10.4.13",
@@ -52,6 +53,7 @@
5253
"husky": "^8.0.3",
5354
"less": "^4.1.3",
5455
"lint-staged": "^13.1.2",
56+
"markdown-it-link-attributes": "^4.0.1",
5557
"npm-run-all": "^4.1.5",
5658
"postcss": "^8.4.21",
5759
"rimraf": "^4.2.0",

pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/views/chat/components/Message/Text.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { computed, ref } from 'vue'
33
import MarkdownIt from 'markdown-it'
44
import mdKatex from '@traptitech/markdown-it-katex'
5+
import mila from 'markdown-it-link-attributes'
56
import hljs from 'highlight.js'
67
import { useBasicLayout } from '@/hooks/useBasicLayout'
78
import { t } from '@/locales'
@@ -31,6 +32,7 @@ const mdi = new MarkdownIt({
3132
},
3233
})
3334
35+
mdi.use(mila, { attrs: { target: '_blank', rel: 'noopener' } })
3436
mdi.use(mdKatex, { blockClass: 'katexmath-block rounded-md p-[10px]', errorColor: ' #cc0000' })
3537
3638
const wrapClass = computed(() => {

0 commit comments

Comments
 (0)