docs: fix marked type

This commit is contained in:
Kevin 2021-11-05 03:50:33 +08:00 committed by 三咲智子
parent 8f79ae7e32
commit d0e4832b47
3 changed files with 10 additions and 3 deletions

View File

@ -1,16 +1,16 @@
<script lang="ts" setup>
import { computed } from 'vue'
import marked from 'marked'
import { parse } from 'marked'
const props = defineProps({
content: String,
content: { type: String, required: true },
})
const attr = 'rel="noreferrer noopenner" target="_blank"'
const parsed = computed(() => {
// Note this is relatively arbitrary so that this could be buggy.
return marked(props.content)
return parse(props.content)
.replace(
/#([0-9]+) by/g,
`<a href="https://github.com/element-plus/element-plus/pull/$1" ${attr}>#$1</a> by`

View File

@ -20,6 +20,7 @@
"devDependencies": {
"@crowdin/cli": "3.7.1",
"@types/markdown-it": "12.2.3",
"@types/marked": "^3.0.2",
"cross-env": "7.0.3",
"markdown-it": "12.2.0",
"markdown-it-container": "3.0.0",

View File

@ -151,6 +151,7 @@ importers:
specifiers:
'@crowdin/cli': 3.7.1
'@types/markdown-it': 12.2.3
'@types/marked': ^3.0.2
'@vueuse/core': 6.7.5
axios: 0.24.0
clipboard-copy: 4.0.1
@ -174,6 +175,7 @@ importers:
devDependencies:
'@crowdin/cli': 3.7.1
'@types/markdown-it': 12.2.3
'@types/marked': 3.0.2
cross-env: 7.0.3
markdown-it: 12.2.0
markdown-it-container: 3.0.0
@ -1747,6 +1749,10 @@ packages:
'@types/mdurl': 1.0.2
dev: true
/@types/marked/3.0.2:
resolution: {integrity: sha512-mGYI9qFs+i5eYaytWKBbtEMbIkrXGKuhsDpDcj70ogKS2gk1NmgEy9Z3VEKz922Lfms6eITXXqv5idlX7C/irw==}
dev: true
/@types/mdurl/1.0.2:
resolution: {integrity: sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==}
dev: true