github.ts

Source

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

Reference

fncollectGitHubRepos(html: string): Promise<string[]>Collect all GitHub repos from HTML for pre-fetching.

Collect all GitHub repos from HTML for pre-fetching.

View source

Parameters

  • html string

Returns

Promise
fncreateFallbackCard(repo: string): ElementCreate fallback element when repo data is unavailable.

Create fallback element when repo data is unavailable.

View source

Parameters

  • repo string

Returns

Element
fncreateGitHubCard(repoData: GitHubRepoData): ElementCreate GitHub card element from repo data.

Create GitHub card element from repo data.

View source

Parameters

  • repoData GitHubRepoData

Returns

Element
fnfetchRepoData(repo: string, options: Required<GitHubOptions>): Promise<GitHubRepoData | null>Fetch repository data from GitHub API.

Fetch repository data from GitHub API.

View source

Parameters

  • repo string
  • options Required

Returns

Promise
fnformatNumber(num: number): stringFormat number with K/M suffix.

Format number with K/M suffix.

View source

Parameters

  • num number

Returns

string
fngetAttribute(el: Element, name: string): string | undefinedGet element attribute value.

Get element attribute value.

View source

Parameters

  • el Element
  • name string

Returns

string | undefined
fnprefetchGitHubRepos(repos: string[], options?: GitHubOptions): Promise<Map<string, GitHubRepoData | null>>Pre-fetch all GitHub repos data.

Pre-fetch all GitHub repos data.

View source

Parameters

  • repos string[]
  • options GitHubOptions

    optional

Returns

Promise
fnrehypeGitHub(repoDataMap: Map<string, GitHubRepoData | null>)Rehype plugin to transform GitHub components.

Rehype plugin to transform GitHub components.

View source

Parameters

  • repoDataMap Map
fntransformGitHub(html: string, repoDataMap?: Map<string, GitHubRepoData | null>, options?: GitHubOptions): Promise<string>Transform GitHub components in HTML.

Transform GitHub components in HTML.

View source

Parameters

  • html string
  • repoDataMap Map

    optional

  • options GitHubOptions

    optional

Returns

Promise