You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
551 B
18 lines
551 B
<template> |
|
<h1> |
|
<span :id="props.id"></span> |
|
<a v-if="props.id && generate" :href="`#${props.id}`"> |
|
<slot /> |
|
</a> |
|
<slot v-else /> |
|
</h1> |
|
</template> |
|
|
|
<script setup lang="ts"> |
|
import { computed, useRuntimeConfig } from "#imports" |
|
|
|
const props = defineProps<{ id?: string }>() |
|
|
|
const { headings } = useRuntimeConfig().public.mdc |
|
const generate = computed(() => props.id && ((typeof headings?.anchorLinks === "boolean" && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === "object" && headings?.anchorLinks?.h1))) |
|
</script>
|
|
|