diff --git a/packages/shared/src/note-image-card.test.mjs b/packages/shared/src/note-image-card.test.mjs index 633f060f..b0322f39 100644 --- a/packages/shared/src/note-image-card.test.mjs +++ b/packages/shared/src/note-image-card.test.mjs @@ -12,6 +12,17 @@ import { pl } from "./i18n/pl"; import { NOTE_IMAGE_FONT_SUBSETS } from "./note-image-font-manifest"; describe("note image templates", () => { + test("author signatures show only the name without a generated avatar in every template", () => { + for (const theme of NOTE_IMAGE_THEME_OPTIONS) { + const markup = buildNoteImageCardMarkup({ theme, title: "Note", bodyHtml: "
Text
", author: "天马", showAuthor: true }); + const { document } = parseHTML(markup); + const signature = document.querySelector(".edgeever-footer-author"); + expect(signature?.textContent).toBe("天马"); + expect(signature?.children.length).toBe(1); + expect(document.querySelector(".edgeever-card-avatar")).toBeNull(); + } + }); + test("each template references the font family registered by its bundled assets", () => { for (const theme of NOTE_IMAGE_THEME_OPTIONS) { const preset = NOTE_IMAGE_TEMPLATE_TYPOGRAPHY[theme]; @@ -118,7 +129,8 @@ describe("note image templates", () => { } } const signed = buildNoteImageCardMarkup({ theme: "bento", title: "Note", bodyHtml: "", author: "天马", showAuthor: true, showBranding: false }); - expect(signed).toContain('天'); + expect(signed).not.toContain('class="edgeever-card-avatar"'); + expect(signed).toContain('天马'); expect(signed).toContain('天马'); expect(signed).not.toContain('class="edgeever-brand-badge"'); }); diff --git a/packages/shared/src/note-image-card.ts b/packages/shared/src/note-image-card.ts index 101b4ad3..fea0d951 100644 --- a/packages/shared/src/note-image-card.ts +++ b/packages/shared/src/note-image-card.ts @@ -207,9 +207,6 @@ export const buildNoteImageCardMarkup = ({ const hasTitle = showTitle && Boolean(title.trim()); const hasAuthor = showAuthor && Boolean(author.trim()); const authorName = hasAuthor ? escapeCardHtml(author.trim()) : ""; - const initial = escapeCardHtml(Array.from(author.trim())[0]?.toUpperCase() || ""); - // Keep identity with the signature, away from the note's reading entry point. - const avatar = hasAuthor ? `` : ""; const meta: string[] = []; const dateHtml = showUpdatedAt && updatedAt.trim() ? `