Skip to content

Commit 47fd14f

Browse files
yepzdkclaude
andcommitted
fix: ignore leading emoji/punctuation when sorting cards alphabetically
Lønforhandlingssystem was sorted by its decorative 🔒 prefix instead of the actual title. Strip leading non-letter characters from the sort key so it lands between Deltag and Opkrævningsoverblik as expected. Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1d1008f commit 47fd14f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

docs/.vitepress/theme/HomeFeatures.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ function formatDate(isoString) {
2626
})
2727
}
2828
29-
function stripTags(html) {
30-
return (html || '').replace(/<[^>]*>/g, '')
29+
function sortKey(title) {
30+
// Strip HTML tags and any leading non-letter characters (emoji, punctuation,
31+
// whitespace) so decorative prefixes like "🔒 " don't affect ordering.
32+
return (title || '')
33+
.replace(/<[^>]*>/g, '')
34+
.replace(/^[^\p{L}]+/u, '')
3135
}
3236
3337
const features = computed(() => {
@@ -58,7 +62,7 @@ const features = computed(() => {
5862
case 'alpha-desc': {
5963
const dir = sort.value === 'alpha-asc' ? 1 : -1
6064
sorted.sort((a, b) =>
61-
dir * stripTags(a.title).localeCompare(stripTags(b.title), 'da')
65+
dir * sortKey(a.title).localeCompare(sortKey(b.title), 'da')
6266
)
6367
break
6468
}

0 commit comments

Comments
 (0)