Skip to content

Commit acc3231

Browse files
committed
Updated: Prose anchors
1 parent 37b152b commit acc3231

File tree

6 files changed

+30
-18
lines changed

6 files changed

+30
-18
lines changed

components/content/ProseH1.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interface ProseH1Properties {
33
id: string
44
}
55
6-
defineProps<ProseH1Properties>()
6+
const { id } = defineProps<{ id: string }>()
77
88
const runtimeConfig = useRuntimeConfig()
99
@@ -13,6 +13,8 @@ const { depth: anchorDepth, exclude: anchorExcluded } = runtimeConfig.public.con
1313
const anchorLinkEnabled = ANCHOR_LINK_LEVEL <= anchorDepth && !anchorExcluded.includes(ANCHOR_LINK_LEVEL)
1414
1515
const { scrollToAnchor } = useAnchorScroll()
16+
17+
const fixedId = `real-${id}`
1618
</script>
1719

1820
<template>
@@ -22,7 +24,7 @@ const { scrollToAnchor } = useAnchorScroll()
2224
flex flex-row gap-4 align-baseline
2325
>
2426
<h1
25-
:id="id"
27+
:id="fixedId"
2628
text-4xl font-extrabold font-inter
2729
>
2830
<slot />
@@ -32,7 +34,7 @@ const { scrollToAnchor } = useAnchorScroll()
3234
:href="`#${id}`"
3335
mb-a mt-a
3436
text-2xl
35-
@click="scrollToAnchor(id)"
37+
@click="scrollToAnchor(fixedId)"
3638
>
3739
#
3840
</NuxtLink>

components/content/ProseH2.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interface ProseH2Properties {
33
id: string
44
}
55
6-
defineProps<ProseH2Properties>()
6+
const { id } = defineProps<{ id: string }>()
77
88
const runtimeConfig = useRuntimeConfig()
99
@@ -13,6 +13,8 @@ const { depth: anchorDepth, exclude: anchorExcluded } = runtimeConfig.public.con
1313
const anchorLinkEnabled = ANCHOR_LINK_LEVEL <= anchorDepth && !anchorExcluded.includes(ANCHOR_LINK_LEVEL)
1414
1515
const { scrollToAnchor } = useAnchorScroll()
16+
17+
const fixedId = `real-${id}`
1618
</script>
1719

1820
<template>
@@ -22,7 +24,7 @@ const { scrollToAnchor } = useAnchorScroll()
2224
flex flex-row gap-4 align-baseline
2325
>
2426
<h2
25-
:id="id"
27+
:id="fixedId"
2628
text-3xl font-extrabold font-inter
2729
>
2830
<slot />
@@ -32,7 +34,7 @@ const { scrollToAnchor } = useAnchorScroll()
3234
:href="`#${id}`"
3335
mb-a mt-a
3436
text-xl
35-
@click="scrollToAnchor(id)"
37+
@click="scrollToAnchor(fixedId)"
3638
>
3739
#
3840
</NuxtLink>

components/content/ProseH3.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interface ProseH3Properties {
33
id: string
44
}
55
6-
defineProps<ProseH3Properties>()
6+
const { id } = defineProps<{ id: string }>()
77
88
const runtimeConfig = useRuntimeConfig()
99
@@ -13,6 +13,8 @@ const { depth: anchorDepth, exclude: anchorExcluded } = runtimeConfig.public.con
1313
const anchorLinkEnabled = ANCHOR_LINK_LEVEL <= anchorDepth && !anchorExcluded.includes(ANCHOR_LINK_LEVEL)
1414
1515
const { scrollToAnchor } = useAnchorScroll()
16+
17+
const fixedId = `real-${id}`
1618
</script>
1719

1820
<template>
@@ -22,7 +24,7 @@ const { scrollToAnchor } = useAnchorScroll()
2224
flex flex-row gap-4 align-baseline
2325
>
2426
<h3
25-
:id="id"
27+
:id="fixedId"
2628
text-2xl font-bold font-inter
2729
>
2830
<slot />
@@ -32,7 +34,7 @@ const { scrollToAnchor } = useAnchorScroll()
3234
:href="`#${id}`"
3335
mb-a mt-a
3436
text-lg
35-
@click="scrollToAnchor(id)"
37+
@click="scrollToAnchor(fixedId)"
3638
>
3739
#
3840
</NuxtLink>

components/content/ProseH4.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interface ProseH4Properties {
33
id: string
44
}
55
6-
defineProps<ProseH4Properties>()
6+
const { id } = defineProps<{ id: string }>()
77
88
const runtimeConfig = useRuntimeConfig()
99
@@ -13,6 +13,8 @@ const { depth: anchorDepth, exclude: anchorExcluded } = runtimeConfig.public.con
1313
const anchorLinkEnabled = ANCHOR_LINK_LEVEL <= anchorDepth && !anchorExcluded.includes(ANCHOR_LINK_LEVEL)
1414
1515
const { scrollToAnchor } = useAnchorScroll()
16+
17+
const fixedId = `real-${id}`
1618
</script>
1719

1820
<template>
@@ -22,7 +24,7 @@ const { scrollToAnchor } = useAnchorScroll()
2224
flex flex-row gap-4 align-baseline
2325
>
2426
<h4
25-
:id="id"
27+
:id="fixedId"
2628
text-xl font-bold font-inter
2729
>
2830
<slot />
@@ -31,7 +33,7 @@ const { scrollToAnchor } = useAnchorScroll()
3133
v-if="anchorLinkEnabled"
3234
:href="`#${id}`"
3335
mb-a mt-a
34-
@click="scrollToAnchor(id)"
36+
@click="scrollToAnchor(fixedId)"
3537
>
3638
#
3739
</NuxtLink>

components/content/ProseH5.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interface ProseH5Properties {
33
id: string
44
}
55
6-
defineProps<ProseH5Properties>()
6+
const { id } = defineProps<{ id: string }>()
77
88
const runtimeConfig = useRuntimeConfig()
99
@@ -13,6 +13,8 @@ const { depth: anchorDepth, exclude: anchorExcluded } = runtimeConfig.public.con
1313
const anchorLinkEnabled = ANCHOR_LINK_LEVEL <= anchorDepth && !anchorExcluded.includes(ANCHOR_LINK_LEVEL)
1414
1515
const { scrollToAnchor } = useAnchorScroll()
16+
17+
const fixedId = `real-${id}`
1618
</script>
1719

1820
<template>
@@ -22,7 +24,7 @@ const { scrollToAnchor } = useAnchorScroll()
2224
flex flex-row gap-4 align-baseline
2325
>
2426
<h5
25-
:id="id"
27+
:id="fixedId"
2628
text-lg font-bold font-inter
2729
>
2830
<slot />
@@ -32,7 +34,7 @@ const { scrollToAnchor } = useAnchorScroll()
3234
:href="`#${id}`"
3335
mb-a mt-a
3436
text-sm
35-
@click="scrollToAnchor(id)"
37+
@click="scrollToAnchor(fixedId)"
3638
>
3739
#
3840
</NuxtLink>

components/content/ProseH6.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interface ProseH6Properties {
33
id: string
44
}
55
6-
defineProps<ProseH6Properties>()
6+
const { id } = defineProps<{ id: string }>()
77
88
const runtimeConfig = useRuntimeConfig()
99
@@ -13,6 +13,8 @@ const { depth: anchorDepth, exclude: anchorExcluded } = runtimeConfig.public.con
1313
const anchorLinkEnabled = ANCHOR_LINK_LEVEL <= anchorDepth && !anchorExcluded.includes(ANCHOR_LINK_LEVEL)
1414
1515
const { scrollToAnchor } = useAnchorScroll()
16+
17+
const fixedId = `real-${id}`
1618
</script>
1719

1820
<template>
@@ -22,7 +24,7 @@ const { scrollToAnchor } = useAnchorScroll()
2224
flex flex-row gap-4 align-baseline
2325
>
2426
<h6
25-
:id="id"
27+
:id="fixedId"
2628
text-lg font-500 font-inter
2729
>
2830
<slot />
@@ -32,7 +34,7 @@ const { scrollToAnchor } = useAnchorScroll()
3234
:href="`#${id}`"
3335
mb-a mt-a
3436
text-sm
35-
@click="scrollToAnchor(id)"
37+
@click="scrollToAnchor(fixedId)"
3638
>
3739
#
3840
</NuxtLink>

0 commit comments

Comments
 (0)