github.ts
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.
Parameters
-
htmlstring
Returns
Promise
fncreateFallbackCard(repo: string): ElementCreate fallback element when repo data is unavailable.
Create fallback element when repo data is unavailable.
Parameters
-
repostring
Returns
Element
fncreateGitHubCard(repoData: GitHubRepoData): ElementCreate GitHub card element from repo data.
Create GitHub card element from repo data.
Parameters
-
repoDataGitHubRepoData
Returns
Element
fnfetchRepoData(repo: string, options: Required<GitHubOptions>): Promise<GitHubRepoData | null>Fetch repository data from GitHub API.
Fetch repository data from GitHub API.
Parameters
-
repostring -
optionsRequired
Returns
Promise
fnformatNumber(num: number): stringFormat number with K/M suffix.
fngetAttribute(el: Element, name: string): string | undefinedGet element attribute value.
Get element attribute value.
Parameters
-
elElement -
namestring
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.
Parameters
-
reposstring[] -
optionsGitHubOptionsoptional
Returns
Promise
fnrehypeGitHub(repoDataMap: Map<string, GitHubRepoData | null>)Rehype plugin to transform GitHub components.
fntransformGitHub(html: string, repoDataMap?: Map<string, GitHubRepoData | null>, options?: GitHubOptions): Promise<string>Transform GitHub components in HTML.
Transform GitHub components in HTML.
Parameters
-
htmlstring -
repoDataMapMapoptional
-
optionsGitHubOptionsoptional
Returns
Promise