ssg.ts
21 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
Reference
fn_generateTocHtml(toc: TocEntry[]): stringGenerates TOC HTML from toc entries.
fnbuildSsg(options: ResolvedOptions, root: string): Promise<{ files: string[]; errors: string[] }>Builds all markdown files to static HTML.
Builds all markdown files to static HTML.
Parameters
-
optionsResolvedOptions -
rootstring
Returns
Promise
fncollectMarkdownFiles(srcDir: string): Promise<string[]>Collects all markdown files from the source directory.
Collects all markdown files from the source directory.
Parameters
-
srcDirstring
Returns
Promise
fnextractTitle(content: string, frontmatter: Record<string, unknown>): stringExtracts title from content or frontmatter.
Extracts title from content or frontmatter.
Parameters
-
contentstring -
frontmatterRecord
Returns
string
fnformatTitle(name: string): stringFormats a file/dir name as a title.
fngenerateBareHtmlPage(content: string, title: string): stringGenerates bare HTML page (no navigation, no styles).
Generates bare HTML page (no navigation, no styles).
Parameters
-
contentstring -
titlestring
Returns
string
fngenerateHtmlPage(pageData: SsgPageData, navGroups: NavGroup[], siteName: string, base: string, ogImage?: string, theme?: ResolvedThemeConfig): Promise<string>Generates HTML page with navigation using Rust NAPI bindings.
Generates HTML page with navigation using Rust NAPI bindings.
Parameters
-
pageDataSsgPageData -
navGroupsNavGroup[] -
siteNamestring -
basestring -
ogImagestringoptional
-
themeResolvedThemeConfigoptional
Returns
Promise
fngetDisplayTitle(filePath: string): stringGets display title from file path.
fngetHref(inputPath: string, srcDir: string, base: string, extension: string): stringConverts a markdown file path to an href.
Converts a markdown file path to an href.
Parameters
-
inputPathstring -
srcDirstring -
basestring -
extensionstring
Returns
string
fngetOgImagePath(inputPath: string, srcDir: string, outDir: string): stringGets the OG image output path for a given markdown file.
Gets the OG image output path for a given markdown file.
Parameters
-
inputPathstring -
srcDirstring -
outDirstring
Returns
string
fngetOgImageUrl(inputPath: string, srcDir: string, base: string, siteUrl?: string): stringGets the OG image URL for use in meta tags. If siteUrl is provided, returns an…
Gets the OG image URL for use in meta tags. If siteUrl is provided, returns an absolute URL (required for SNS sharing).
Parameters
-
inputPathstring -
srcDirstring -
basestring -
siteUrlstringoptional
Returns
string
fngetOutputPath(inputPath: string, srcDir: string, outDir: string, extension: string): stringConverts a markdown file path to its corresponding HTML output path.
Converts a markdown file path to its corresponding HTML output path.
Parameters
-
inputPathstring -
srcDirstring -
outDirstring -
extensionstring
Returns
string
fngetUrlPath(inputPath: string, srcDir: string): stringConverts a markdown file path to a relative URL path.
Converts a markdown file path to a relative URL path.
Parameters
-
inputPathstring -
srcDirstring
Returns
string
fnrenderTemplate(template: string, data: Record<string, unknown>): stringSimple mustache-like template rendering.
Simple mustache-like template rendering.
Parameters
-
templatestring -
dataRecord
Returns
string
fnresolveSsgOptions(ssg: SsgOptions | boolean | undefined): ResolvedSsgOptionsResolves SSG options with defaults.
Resolves SSG options with defaults.
Parameters
-
ssgSsgOptions | boolean | undefined
Returns
ResolvedSsgOptions
interfaceSsgEntryPageConfigEntry page configuration for SSG (passed to Rust).
Entry page configuration for SSG (passed to Rust).
interfaceSsgPageDataPage data for SSG.
Page data for SSG.