Skip to content

parse.ts#

View Markdown

Source

3 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.

3 symbols 3 functions 5 parameters 3 returns

Reference#

fndecodeHtmlEntities(value: string): stringExpand the character references that show up in <meta> content. Metadata is mar…

Expand the character references that show up in <meta> content.

Metadata is markup, so an og:title of Tips & Tricks reaches us as Tips &amp; Tricks. Rendering that verbatim puts the raw entity on the card, and it is the renderer's job — not the author's — to escape the text again.

Signature

export function decodeHtmlEntities(value: string): string

View source

Parameters

  • value string

Returns

string
fnfaviconUrl(html: string, pageUrl: string): string | undefinedThe site's own icon, never a third-party favicon lookup service. Routing every…

The site's own icon, never a third-party favicon lookup service.

Routing every card through an external service would tell that service which outbound links each documentation page carries, for every reader, and would make cards depend on a host the build never chose.

Signature

function faviconUrl(html: string, pageUrl: string): string | undefined

View source

Parameters

  • html string
  • pageUrl string

Returns

string | undefined
fnresolveMetaUrl(value: string, pageUrl: string): string | undefinedResolve a URL taken from page metadata against the page it came from. Open Grap…

Resolve a URL taken from page metadata against the page it came from.

Open Graph lets a site write og:image as an absolute URL, a protocol-relative one, or a path relative to the document. Only the first form is usable as-is: the other two have to be resolved against the source page, not against whatever docs page ends up embedding the card.

Signature

export function resolveMetaUrl(value: string, pageUrl: string): string | undefined

View source

Parameters

  • value string
  • pageUrl string

Returns

string | undefined