element-plus/docs/.vitepress/vitepress/components/common/vp-markdown.vue
jeremywu 9408e7eb76
feat(docs): document add changelog page (#3596)
* feat(docs): document add changelog page

- Add changelog and markdown component for changelog.md
- Add changelog page
- Add some locale for change log
- Fix a bug that caused ToC not working

* Add minimal width to changelog selector

* Add width to changelog selector

* fix selector width issue
2021-09-24 01:19:18 +08:00

34 lines
714 B
Vue

<script lang="ts" setup>
import { computed } from 'vue'
import marked from 'marked'
const props = defineProps({
content: String,
})
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)
.replace(
/#([0-9]+) by/g,
`<a href="https://github.com/element-plus/element-plus/pull/$1" ${attr}>#$1</a> by`
)
.replace(
/@([A-Za-z0-9_-]+)/g,
`<a href="https://github.com/$1" ${attr}>@$1</a>`
)
})
</script>
<template>
<div class="markdown-wrapper" v-html="parsed" />
</template>
<style>
.markdown-wrapper h3 {
margin-top: 1rem;
}
</style>