Skip to content

Commit 68b1d41

Browse files
committed
Don't use @html description (and strip out makdown links). Description can be overrritten
1 parent 065ec62 commit 68b1d41

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

apps/svelte.dev/src/lib/packages-meta.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ const FEATURED: {
208208
packages: [
209209
{ name: '@sveltejs/kit' },
210210
{ name: 'svelte-routing' },
211-
{ name: '@roxi/routify' },
211+
{ name: '@roxi/routify', description: 'Automate Svelte routes based on file structure.' },
212212
{ name: 'svelte5-router' },
213213
{ name: 'svelte-pathfinder' },
214214
{ name: 'universal-router' }
@@ -527,7 +527,16 @@ function supports_svelte_versions(version_range: string): {
527527
function calculate_description(pkg: PackageKey & PackageNpm): string {
528528
const found = FEATURED.flatMap((f) => f.packages).find((p) => p.name === pkg.name);
529529
if (found && found.description) return found.description;
530-
return pkg.npm_description ?? 'NO DESCRIPTION!';
530+
531+
let desc = pkg.npm_description ?? 'NO DESCRIPTION!';
532+
const replaces = [
533+
// strip out markdown links
534+
{ key: /\[(.*?)\]\((.*?)\)/g, value: '$1' }
535+
];
536+
for (const { key, value } of replaces) {
537+
desc = desc.replace(key, value);
538+
}
539+
return desc;
531540
}
532541

533542
export const PACKAGES_META = {

apps/svelte.dev/src/routes/packages/PackageCard.svelte

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@
88
};
99
1010
let { pkg }: Props = $props();
11-
12-
// transform [text](https://url) to <a href="url" target="_blank" rel="noreferrer">text</a>
13-
const htmlDescription = $derived(
14-
pkg.description?.replace(
15-
/\[(.*?)\]\((.*?)\)/g,
16-
'<a href="$2" target="_blank" rel="noreferrer">$1</a>'
17-
)
18-
);
1911
</script>
2012

2113
<article data-pubdate={pkg.updated}>
@@ -49,7 +41,7 @@
4941
</span>
5042
</header>
5143

52-
<p class="description">{@html htmlDescription}</p>
44+
<p class="description">{pkg.description}</p>
5345

5446
<p class="stats">
5547
{#if pkg.downloads}

0 commit comments

Comments
 (0)