Skip to content

Commit f239c39

Browse files
fix: decode HTML entities in TOC dropdown labels (#1550)
Co-authored-by: TAKAHASHI Shuuji <id@shuuji3.xyz>
1 parent f9fca21 commit f239c39

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/components/ReadmeTocDropdown.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import type { TocItem } from '#shared/types/readme'
33
import { onClickOutside, useEventListener } from '@vueuse/core'
4+
import { decodeHtmlEntities } from '~/utils/formatters'
45
56
const props = defineProps<{
67
toc: TocItem[]
@@ -201,7 +202,7 @@ function handleKeydown(event: KeyboardEvent) {
201202
@click="select()"
202203
@mouseenter="highlightedIndex = getIndex(node.id)"
203204
>
204-
<span class="truncate">{{ node.text }}</span>
205+
<span class="truncate">{{ decodeHtmlEntities(node.text) }}</span>
205206
</NuxtLink>
206207

207208
<template v-for="child in node.children" :key="child.id">
@@ -219,7 +220,7 @@ function handleKeydown(event: KeyboardEvent) {
219220
@click="select()"
220221
@mouseenter="highlightedIndex = getIndex(child.id)"
221222
>
222-
<span class="truncate">{{ child.text }}</span>
223+
<span class="truncate">{{ decodeHtmlEntities(child.text) }}</span>
223224
</NuxtLink>
224225

225226
<NuxtLink
@@ -240,7 +241,7 @@ function handleKeydown(event: KeyboardEvent) {
240241
@click="select()"
241242
@mouseenter="highlightedIndex = getIndex(grandchild.id)"
242243
>
243-
<span class="truncate">{{ grandchild.text }}</span>
244+
<span class="truncate">{{ decodeHtmlEntities(grandchild.text) }}</span>
244245
</NuxtLink>
245246
</template>
246247
</template>

0 commit comments

Comments
 (0)