feat(docs): right menu tag convert (#12606)

* feat(docs): right menu tag convert

* fix: use localMd
This commit is contained in:
btea 2023-04-25 22:16:38 +08:00 committed by GitHub
parent 3942e10340
commit 167582d8b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import MarkdownIt from 'markdown-it'
import { useToc } from '../../composables/use-toc'
import { useActiveSidebarLinks } from '../../composables/active-bar'
@ -8,8 +9,10 @@ import { useLang } from '../../composables/lang'
import SponsorsButton from '../sponsors/sponsors-button.vue'
import SponsorRightTextList from '../sponsors/right-richtext-list.vue'
import SponsorRightLogoSmallList from '../sponsors/right-logo-small-list.vue'
import tag from '../../../plugins/tag'
// import SponsorLarge from '../vp-sponsor-large.vue'
const localMd = MarkdownIt().use(tag)
const headers = useToc()
const marker = ref()
const container = ref()
@ -28,16 +31,24 @@ const sponsor = computed(() => sponsorLocale[lang.value])
:key="link"
class="toc-item"
>
<a class="toc-link" :href="link" :title="text">{{ text }}</a>
<a
class="toc-link"
:href="link"
:title="text"
v-html="localMd.render(text)"
/>
<ul v-if="children">
<li
v-for="{ link: childLink, text: childText } in children"
:key="childLink"
class="toc-item"
>
<a class="toc-link subitem" :href="childLink" :title="text">{{
childText
}}</a>
<a
class="toc-link subitem"
:href="childLink"
:title="text"
v-html="localMd.render(childText)"
/>
</li>
</ul>
</li>