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

@@ -53,6 +53,7 @@ import {
userPath,
} from "../../shared/paths.ts";
import { NotFound } from "./NotFound.tsx";
import { markdownToPlainText } from "../../shared/markdown.ts";
/**
* Held by `Search` for a query, from the first page of `SearchResults`. The
@@ -297,21 +298,27 @@ export function Search(): React.JSX.Element {
? <p className="search-page-empty">{t`No users match "${q}".`}</p>
: (
<ul className="user-results">
{results.users.map((u) => (
<li key={u.id}>
<Link
to={userPath(u.username)}
className="user-result-item"
>
<span className="user-result-name">@{u.username}</span>
{u.description && (
<span className="user-result-description">
{u.description}
</span>
)}
</Link>
</li>
))}
{results.users.map((u) => {
// The profile renders the description's Markdown; this
// line has room for its text only.
const description = u.description &&
markdownToPlainText(u.description, "");
return (
<li key={u.id}>
<Link
to={userPath(u.username)}
className="user-result-item"
>
<span className="user-result-name">@{u.username}</span>
{description && (
<span className="user-result-description">
{description}
</span>
)}
</Link>
</li>
);
})}
</ul>
)
)}