ssg.ts

Source

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

Reference

fn_generateNavHtml(navGroups: NavGroup[], currentPath: string): stringGenerates navigation HTML from nav groups.

Generates navigation HTML from nav groups.

View source

Parameters

  • navGroups NavGroup[]
  • currentPath string

Returns

string
fn_generateTocHtml(toc: TocEntry[]): stringGenerates TOC HTML from toc entries.

Generates TOC HTML from toc entries.

View source

Parameters

  • toc TocEntry[]

Returns

string
fnbuildNavItems(markdownFiles: string[], srcDir: string, base: string, extension: string): NavGroup[]Builds navigation items from markdown files, grouped by directory.

Builds navigation items from markdown files, grouped by directory.

View source

Parameters

  • markdownFiles string[]
  • srcDir string
  • base string
  • extension string

Returns

NavGroup[]
fnbuildSsg(options: ResolvedOptions, root: string): Promise<{ files: string[]; errors: string[] }>Builds all markdown files to static HTML.

Builds all markdown files to static HTML.

View source

Parameters

  • options ResolvedOptions
  • root string

Returns

Promise
fncollectMarkdownFiles(srcDir: string): Promise<string[]>Collects all markdown files from the source directory.

Collects all markdown files from the source directory.

View source

Parameters

  • srcDir string

Returns

Promise
fnextractTitle(content: string, frontmatter: Record<string, unknown>): stringExtracts title from content or frontmatter.

Extracts title from content or frontmatter.

View source

Parameters

  • content string
  • frontmatter Record

Returns

string
fnformatTitle(name: string): stringFormats a file/dir name as a title.

Formats a file/dir name as a title.

View source

Parameters

  • name string

Returns

string
fngenerateBareHtmlPage(content: string, title: string): stringGenerates bare HTML page (no navigation, no styles).

Generates bare HTML page (no navigation, no styles).

View source

Parameters

  • content string
  • title string

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.

View source

Parameters

  • pageData SsgPageData
  • navGroups NavGroup[]
  • siteName string
  • base string
  • ogImage string

    optional

  • theme ResolvedThemeConfig

    optional

Returns

Promise
fngetDisplayTitle(filePath: string): stringGets display title from file path.

Gets display title from file path.

View source

Parameters

  • filePath string

Returns

string
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.

View source

Parameters

  • inputPath string
  • srcDir string
  • base string
  • extension string

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.

View source

Parameters

  • inputPath string
  • srcDir string
  • outDir string

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).

View source

Parameters

  • inputPath string
  • srcDir string
  • base string
  • siteUrl string

    optional

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.

View source

Parameters

  • inputPath string
  • srcDir string
  • outDir string
  • extension string

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.

View source

Parameters

  • inputPath string
  • srcDir string

Returns

string
interfaceNavGroupNavigation group for hierarchical navigation.

Navigation group for hierarchical navigation.

View source

fnrenderTemplate(template: string, data: Record<string, unknown>): stringSimple mustache-like template rendering.

Simple mustache-like template rendering.

View source

Parameters

  • template string
  • data Record

Returns

string
fnresolveSsgOptions(ssg: SsgOptions | boolean | undefined): ResolvedSsgOptionsResolves SSG options with defaults.

Resolves SSG options with defaults.

View source

Parameters

  • ssg SsgOptions | boolean | undefined

Returns

ResolvedSsgOptions
interfaceSsgEntryPageConfigEntry page configuration for SSG (passed to Rust).

Entry page configuration for SSG (passed to Rust).

View source

interfaceSsgNavItemNavigation item for SSG.

Navigation item for SSG.

View source

interfaceSsgPageDataPage data for SSG.

Page data for SSG.

View source