feat(md): add _blank for all links with http/https (#141)
This commit is contained in:
parent
4335ed3e6a
commit
e3bc59a5f7
@ -27,6 +27,7 @@
|
|||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^7.28.0",
|
"eslint": "^7.28.0",
|
||||||
"https-localhost": "^4.6.5",
|
"https-localhost": "^4.6.5",
|
||||||
|
"markdown-it-link-attributes": "^3.0.0",
|
||||||
"markdown-it-prism": "^2.1.6",
|
"markdown-it-prism": "^2.1.6",
|
||||||
"pnpm": "^6.7.6",
|
"pnpm": "^6.7.6",
|
||||||
"typescript": "^4.3.2",
|
"typescript": "^4.3.2",
|
||||||
|
@ -14,6 +14,7 @@ specifiers:
|
|||||||
cross-env: ^7.0.3
|
cross-env: ^7.0.3
|
||||||
eslint: ^7.28.0
|
eslint: ^7.28.0
|
||||||
https-localhost: ^4.6.5
|
https-localhost: ^4.6.5
|
||||||
|
markdown-it-link-attributes: ^3.0.0
|
||||||
markdown-it-prism: ^2.1.6
|
markdown-it-prism: ^2.1.6
|
||||||
nprogress: ^0.2.0
|
nprogress: ^0.2.0
|
||||||
pnpm: ^6.7.6
|
pnpm: ^6.7.6
|
||||||
@ -54,6 +55,7 @@ devDependencies:
|
|||||||
cross-env: 7.0.3
|
cross-env: 7.0.3
|
||||||
eslint: 7.28.0
|
eslint: 7.28.0
|
||||||
https-localhost: 4.6.5
|
https-localhost: 4.6.5
|
||||||
|
markdown-it-link-attributes: 3.0.0
|
||||||
markdown-it-prism: 2.1.6
|
markdown-it-prism: 2.1.6
|
||||||
pnpm: 6.7.6
|
pnpm: 6.7.6
|
||||||
typescript: 4.3.2
|
typescript: 4.3.2
|
||||||
@ -5049,6 +5051,10 @@ packages:
|
|||||||
engines: {node: '>=4'}
|
engines: {node: '>=4'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/markdown-it-link-attributes/3.0.0:
|
||||||
|
resolution: {integrity: sha512-B34ySxVeo6MuEGSPCWyIYryuXINOvngNZL87Mp7YYfKIf6DcD837+lXA8mo6EBbauKsnGz22ZH0zsbOiQRWTNg==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/markdown-it-prism/2.1.6:
|
/markdown-it-prism/2.1.6:
|
||||||
resolution: {integrity: sha512-fuo5lq36A6kzb882vCsvdyh4HUzpwdfNkAl92cr+MjUO0Q9foz/7MZ/RpKRBlZSwt86LmPlW7ubaEwf4C+0b3g==}
|
resolution: {integrity: sha512-fuo5lq36A6kzb882vCsvdyh4HUzpwdfNkAl92cr+MjUO0Q9foz/7MZ/RpKRBlZSwt86LmPlW7ubaEwf4C+0b3g==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
|
@ -10,6 +10,7 @@ import WindiCSS from 'vite-plugin-windicss'
|
|||||||
import { VitePWA } from 'vite-plugin-pwa'
|
import { VitePWA } from 'vite-plugin-pwa'
|
||||||
import VueI18n from '@intlify/vite-plugin-vue-i18n'
|
import VueI18n from '@intlify/vite-plugin-vue-i18n'
|
||||||
import Prism from 'markdown-it-prism'
|
import Prism from 'markdown-it-prism'
|
||||||
|
import LinkAttributes from 'markdown-it-link-attributes'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
@ -37,6 +38,13 @@ export default defineConfig({
|
|||||||
markdownItSetup(md) {
|
markdownItSetup(md) {
|
||||||
// https://prismjs.com/
|
// https://prismjs.com/
|
||||||
md.use(Prism)
|
md.use(Prism)
|
||||||
|
md.use(LinkAttributes, {
|
||||||
|
pattern: /^https?:\/\//,
|
||||||
|
attrs: {
|
||||||
|
target: '_blank',
|
||||||
|
rel: 'noopener',
|
||||||
|
},
|
||||||
|
})
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user