ssg.ts
SsgNavItem
interface
Navigation item for SSG.
SsgPageData
interface
Page data for SSG.
resolveSsgOptions
function
Resolves SSG options with defaults.
export function resolveSsgOptions(ssg: SsgOptions | boolean | undefined): ResolvedSsgOptions
Returns
ResolvedSsgOptions -
renderTemplate
function
Simple mustache-like template rendering.
function renderTemplate(template: string, data: Record<string, unknown>): string
Returns
string -
extractTitle
function
Extracts title from content or frontmatter.
function extractTitle(
content: string,
frontmatter: Record<string, unknown>
): string
Returns
string -
generateNavHtml
function
Generates navigation HTML from nav groups.
function generateNavHtml(navGroups: NavGroup[], currentPath: string): string
Returns
string -
generateTocHtml
function
Generates TOC HTML from toc entries.
function generateTocHtml(toc: TocEntry[]): string
Returns
string -
generateBareHtmlPage
function
Generates bare HTML page (no navigation, no styles).
export function generateBareHtmlPage(
content: string,
title: string
): string
Returns
string -
generateHtmlPage
function
Generates HTML page with navigation using Rust NAPI bindings.
getOutputPath
function
Converts a markdown file path to its corresponding HTML output path.
getUrlPath
function
Converts a markdown file path to a relative URL path.
function getUrlPath(inputPath: string, srcDir: string): string
Returns
string -
getHref
function
Converts a markdown file path to an href.
function getHref(inputPath: string, srcDir: string, base: string, extension: string): string
Returns
string -
getOgImagePath
function
Gets the OG image output path for a given markdown file.
function getOgImagePath(inputPath: string, srcDir: string, outDir: string): string
Returns
string -
getOgImageUrl
function
Gets the OG image URL for use in meta tags. If siteUrl is provided, returns an absolute URL (required for SNS sharing).
function getOgImageUrl(inputPath: string, srcDir: string, base: string, siteUrl?: string): string
Returns
string -
getDisplayTitle
function
Gets display title from file path.
function getDisplayTitle(filePath: string): string
Returns
string -
formatTitle
function
Formats a file/dir name as a title.
function formatTitle(name: string): string
Returns
string -
collectMarkdownFiles
function
Collects all markdown files from the source directory.
export async function collectMarkdownFiles(srcDir: string): Promise<string[]>
Returns
Promise<string[]> -
NavGroup
interface
Navigation group for hierarchical navigation.
buildNavItems
function
Builds navigation items from markdown files, grouped by directory.
buildSsg
function
Builds all markdown files to static HTML.
export async function buildSsg(
options: ResolvedOptions,
root: string
): Promise<
Returns
Promise< -