Open Extarys opened 1 year ago
Sorry for replying so late!
I'm poor in Nuxt MDC, but I think you should define Anchor
outside the markdown via some config.
<template>
<div ref="mdc">
<MDC />
</div>
<Anchor>
<AnchorLink v-for="item in anchors" :key="item.id" :to="`#${item.id}`">
{{ item.name }}
</AnchorLink>
</Anchor>
</template>
<script lang="ts" setup>
const mdc = ref<HTMLElement>()
const anchors = reactive<{ id: string, name: string }[]>([])
onMounted(() => {
const links = mdc.value?.querySelectorAll('a.anchor')
if (!links?.length) return
// build anchors
})
</script>
Description
I need to use the
Anchor
in Nuxt Content, any idea how I can make the component available for MDC?Validations