refac: citations display

This commit is contained in:
Timothy Jaeryang Baek
2025-09-09 17:27:38 +04:00
parent 0214c1e66c
commit d0b20df46c
4 changed files with 111 additions and 125 deletions
@@ -37,6 +37,14 @@
return title;
}
const getDisplayTitle = (title: string) => {
if (!title) return 'N/A';
if (title.length > 30) {
return title.slice(0, 15) + '...' + title.slice(-10);
}
return title;
};
$: attributes = extractAttributes(token.text);
</script>
@@ -48,9 +56,11 @@
}}
>
<span class="line-clamp-1">
{decodeURIComponent(attributes.title)
? formattedTitle(decodeURIComponent(attributes.title))
: ''}
{getDisplayTitle(
decodeURIComponent(attributes.title)
? formattedTitle(decodeURIComponent(attributes.title))
: ''
)}
</span>
</button>
{/if}