v4: a description shows as text where a list quotes it — a playlist's card printed its description as written, so one holding an image showed "![](/api/attachments/…)", and so did a user's line in the search results. Both now go through markdownToPlainText (shared/markdown.ts), as the chat's reply previews do: the markup goes, a link keeps its text, an image is left out, and a description of nothing but an image leaves no line. The playlist's page and the profile render the Markdown as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
khannurien
2026-10-10 08:12:44 +00:00
parent 1d56c323a4
commit ffc071af4c
4 changed files with 60 additions and 19 deletions

View File

@@ -38,6 +38,34 @@ describe("PlaylistCard", () => {
expect(currentPath()).toBe("/@ann/playlists/mix");
});
test("the description shows as text, without its Markdown or its images", () => {
const withText = renderWithContexts(
<ul>
<PlaylistCard
playlist={makePlaylist({
description:
"**Late** [tunes](https://x.y) ![](/api/attachments/a1)",
})}
/>
</ul>,
);
expect(
withText.container.querySelector(".playlist-card-description"),
).toHaveTextContent(/^Late tunes$/);
withText.unmount();
const imageOnly = renderWithContexts(
<ul>
<PlaylistCard
playlist={makePlaylist({ description: "![](/api/attachments/a1)" })}
/>
</ul>,
);
expect(
imageOnly.container.querySelector(".playlist-card-description"),
).toBeNull();
});
test("the owner doesn't see their own name, or an unread dot", () => {
const p = makePlaylist({ ownerUsername: "me", createdAt: new Date() });
const { container } = renderWithContexts(