Skip to content

deriveCaption

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/apps/web/src/components/Viewer/captionRules.ts

Decide whether an image's alt text is a meaningful

. Returns the trimmed caption, or null when it should be suppressed because it is empty, a generic placeholder word, a bare filename, or a duplicate of the page heading (the page already renders that title as the H1).

Signature

ts
function deriveCaption(alt: string, documentTitle: string): string | null

Parameters

NameType
altstring
documentTitlestring

Returns: string | null

Was this page helpful?

Download as PDF