theme-renderer.ts

Source

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

10 symbols 5 functions 3 interfaces 1 types 1 modules 11 parameters 16 members 6 returns 1 examples

Reference

fncreateTheme(config: { layouts: Record<string, ThemeComponent>; defaultLayout?: string; }): ThemeComponentCreates a theme with layout switching support.

Creates a theme with layout switching support.

Signature

export function createTheme(config: {
  layouts: Record<string, ThemeComponent>;
  defaultLayout?: string;
}): ThemeComponent

View source

Parameters

  • config { layouts: Record<string, ThemeComponent>; defaultLayout?: string }
  • config.layouts Record<string, ThemeComponent>
  • config.defaultLayout? string

    optional

Returns

ThemeComponent

Examples

Example 1
import { createTheme } from '@ox-content/vite-plugin';
import { DefaultLayout } from './layouts/Default';
import { EntryLayout } from './layouts/Entry';

fnDefaultTheme({ children }: ThemeProps): JSXNodeDefault theme component. A minimal theme that renders page content with basic s…

Default theme component. A minimal theme that renders page content with basic styling.

Signature

export function DefaultTheme({ children }: ThemeProps): JSXNode

View source

Parameters

Returns

JSXNode
fngenerateTypes(pages: PageData[], outDir: string): Promise<void>Generates TypeScript type definitions from page frontmatter.

Generates TypeScript type definitions from page frontmatter.

Signature

export async function generateTypes(pages: PageData[], outDir: string): Promise<void>

View source

Parameters

  • pages PageData[]

    All pages

  • outDir string

    Output directory for types

Returns

Promise<void>
interfacePageDataPage data for rendering.

Page data for rendering.

Signature

export interface PageData

View source

Members

Properties
NameTypeDescription
descriptionoptional string
Page description
frontmatter Record<string, unknown>
Frontmatter
html string
Rendered HTML content
lastUpdatedoptional number
Last git commit timestamp in milliseconds
layoutoptional string
Layout name
path string
Source file path
title string
Page title
toc TocEntry[]
Table of contents
url string
Output URL path
fnrenderAllPages(pages: PageData[], options: ThemeRenderOptions): Promise<Map<string, string>>Renders all pages and generates type definitions.

Renders all pages and generates type definitions.

Signature

export async function renderAllPages(pages: PageData[], options: ThemeRenderOptions): Promise<Map<string, string>>

View source

Parameters

Returns

Promise<Map<string, string>>

Map of output paths to rendered HTML

fnrenderPage(page: PageData, options: ThemeRenderOptions): stringRenders a page using the theme component.

Renders a page using the theme component.

Signature

export function renderPage(page: PageData, options: ThemeRenderOptions): string

View source

Parameters

Returns

string

Rendered HTML string

moduletheme-rendererTheme Renderer for Static HTML Generation Renders JSX theme components to static HTML strings. No client-side JavaScrip…

Theme Renderer for Static HTML Generation

Renders JSX theme components to static HTML strings. No client-side JavaScript is included by default.

View source

typeThemeComponent = (props: ThemeProps) => JSXNodeTheme component type.

Theme component type.

Signature

export type ThemeComponent = (props: ThemeProps) => JSXNode

View source

Parameters

Returns

JSXNode
interfaceThemePropsProps passed to the theme component.

Props passed to the theme component.

Signature

export interface ThemeProps

View source

Members

Properties
NameTypeDescription
children JSXNode
Rendered page content as JSX
interfaceThemeRenderOptionsTheme render options.

Theme render options.

Signature

export interface ThemeRenderOptions

View source

Members

Properties
NameTypeDescription
base string
Base URL path
nav NavGroup[]
Navigation groups
pages PageData[]
All pages (for site context)
siteName string
Site name
theme ThemeComponent
Theme component to use
  • props
typesOutDiroptional string
Output directory for type definitions