Skip to content

Commit 7205b6d

Browse files
authored
Merge pull request #3766 from bgruening/hof-main-text
this renders HoF text on top as markdown
2 parents a039c5b + 446373c commit 7205b6d

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

astro/src/pages/hall-of-fame/[slug].astro

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import BaseLayout from '../../layouts/BaseLayout.astro';
3+
import { marked } from 'marked';
34
import {
45
communitySlug,
56
contributorHasHallOfFame,
@@ -42,6 +43,7 @@ const profileDescription =
4243
(community as any)?.record?.bio ||
4344
(community as any)?.record?.description ||
4445
(community as any)?.record?.funding_statement;
46+
const profileDescriptionHtml = profileDescription ? marked.parse(profileDescription) : '';
4547
const githubHandle =
4648
community?.record && (community as any).type === 'contributor'
4749
? (() => {
@@ -145,7 +147,11 @@ function formatDate(date: Date | string | undefined): string {
145147
</div>
146148
{
147149
profileDescription ? (
148-
<p class="text-white/80 text-lg max-w-3xl whitespace-pre-line">{profileDescription}</p>
150+
<div
151+
class="profile-description text-lg max-w-3xl"
152+
data-profile-description
153+
set:html={profileDescriptionHtml}
154+
/>
149155
) : (
150156
<p class="text-white/80 text-lg max-w-2xl">
151157
{matchedType
@@ -389,6 +395,37 @@ function formatDate(date: Date | string | undefined): string {
389395
z-index: 1;
390396
}
391397

398+
.profile-description {
399+
color: rgb(255 255 255 / 0.8);
400+
}
401+
402+
.profile-description :global(p) {
403+
margin: 0.5rem 0;
404+
}
405+
406+
.profile-description :global(p:first-child) {
407+
margin-top: 0;
408+
}
409+
410+
.profile-description :global(p:last-child) {
411+
margin-bottom: 0;
412+
}
413+
414+
.profile-description :global(ul),
415+
.profile-description :global(ol) {
416+
margin: 0.5rem 0 0.5rem 1.2rem;
417+
}
418+
419+
.profile-description :global(a) {
420+
color: var(--color-galaxy-gold);
421+
text-decoration: underline;
422+
text-underline-offset: 2px;
423+
}
424+
425+
.profile-description :global(a:hover) {
426+
color: #fff;
427+
}
428+
392429
.profile-avatar {
393430
width: 110px;
394431
height: 110px;

astro/tests/hall-of-fame.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { test, expect } from '@playwright/test';
22

33
const supporterSlug = 'eurosciencegateway'; // credited via contributions.funding
4+
const markdownProfileSlug = 'nfdi4bioimage';
45

56
test.describe('Hall of Fame', () => {
67
test('/hall-of-fame/ lists contributors', async ({ page }) => {
@@ -37,4 +38,19 @@ test.describe('Hall of Fame', () => {
3738
const backLink = page.locator('a[href="/hall-of-fame/"]').first();
3839
await expect(backLink).toBeVisible();
3940
});
41+
42+
test(`/hall-of-fame/${markdownProfileSlug} renders markdown profile text while keeping contribution teasers plain`, async ({
43+
page,
44+
}) => {
45+
const response = await page.goto(`/hall-of-fame/${markdownProfileSlug}/`);
46+
expect(response?.status()).toBe(200);
47+
48+
const profileDescription = page.locator('[data-profile-description]').first();
49+
await expect(profileDescription).toBeVisible();
50+
await expect(profileDescription.locator('a[href="https://nfdi4bioimage.de/"]').first()).toBeVisible();
51+
await expect(profileDescription).not.toContainText('[NFDI4BIOIMAGE](');
52+
53+
// News/Event teases are treated as plain text and should not render markdown links.
54+
await expect(page.locator('[data-item] p.line-clamp-2 a')).toHaveCount(0);
55+
});
4056
});

0 commit comments

Comments
 (0)