feat: 渲染的链接新窗口打开

main
ChenZhaoYu 2 years ago
parent 08b5772420
commit d422a805f6

@ -37,6 +37,7 @@
"linkify",
"logprobs",
"mdhljs",
"mila",
"nodata",
"OPENAI",
"pinia",

@ -43,6 +43,7 @@
"@types/crypto-js": "^4.1.1",
"@types/katex": "^0.16.0",
"@types/markdown-it": "^12.2.3",
"@types/markdown-it-link-attributes": "^3.0.1",
"@types/node": "^18.14.6",
"@vitejs/plugin-vue": "^4.0.0",
"autoprefixer": "^10.4.13",
@ -52,6 +53,7 @@
"husky": "^8.0.3",
"less": "^4.1.3",
"lint-staged": "^13.1.2",
"markdown-it-link-attributes": "^4.0.1",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.21",
"rimraf": "^4.2.0",

@ -9,6 +9,7 @@ specifiers:
'@types/crypto-js': ^4.1.1
'@types/katex': ^0.16.0
'@types/markdown-it': ^12.2.3
'@types/markdown-it-link-attributes': ^3.0.1
'@types/node': ^18.14.6
'@vitejs/plugin-vue': ^4.0.0
'@vueuse/core': ^9.13.0
@ -23,6 +24,7 @@ specifiers:
less: ^4.1.3
lint-staged: ^13.1.2
markdown-it: ^13.0.1
markdown-it-link-attributes: ^4.0.1
naive-ui: ^2.34.3
npm-run-all: ^4.1.5
pinia: ^2.0.33
@ -58,6 +60,7 @@ devDependencies:
'@types/crypto-js': 4.1.1
'@types/katex': 0.16.0
'@types/markdown-it': 12.2.3
'@types/markdown-it-link-attributes': 3.0.1
'@types/node': 18.14.6
'@vitejs/plugin-vue': 4.0.0_vite@4.2.0+vue@3.2.47
autoprefixer: 10.4.13_postcss@8.4.21
@ -67,6 +70,7 @@ devDependencies:
husky: 8.0.3
less: 4.1.3
lint-staged: 13.1.2
markdown-it-link-attributes: 4.0.1
npm-run-all: 4.1.5
postcss: 8.4.21
rimraf: 4.3.0
@ -2065,6 +2069,12 @@ packages:
resolution: {integrity: sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ==}
dev: false
/@types/markdown-it-link-attributes/3.0.1:
resolution: {integrity: sha512-K8RnNb1q8j7rDOJbMF7AnlhCC/45BjrQ8z3WZWOrvkBIl8u9RXvmBdG/hfpnmK1JhhEZcmFEKWt+ilW1Mly+2Q==}
dependencies:
'@types/markdown-it': 12.2.3
dev: true
/@types/markdown-it/12.2.3:
resolution: {integrity: sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==}
dependencies:
@ -4848,6 +4858,10 @@ packages:
engines: {node: '>=8'}
dev: true
/markdown-it-link-attributes/4.0.1:
resolution: {integrity: sha512-pg5OK0jPLg62H4k7M9mRJLT61gUp9nvG0XveKYHMOOluASo9OEF13WlXrpAp2aj35LbedAy3QOCgQCw0tkLKAQ==}
dev: true
/markdown-it/13.0.1:
resolution: {integrity: sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==}
hasBin: true

@ -2,6 +2,7 @@
import { computed, ref } from 'vue'
import MarkdownIt from 'markdown-it'
import mdKatex from '@traptitech/markdown-it-katex'
import mila from 'markdown-it-link-attributes'
import hljs from 'highlight.js'
import { useBasicLayout } from '@/hooks/useBasicLayout'
import { t } from '@/locales'
@ -31,6 +32,7 @@ const mdi = new MarkdownIt({
},
})
mdi.use(mila, { attrs: { target: '_blank', rel: 'noopener' } })
mdi.use(mdKatex, { blockClass: 'katexmath-block rounded-md p-[10px]', errorColor: ' #cc0000' })
const wrapClass = computed(() => {

Loading…
Cancel
Save