theme-renderer.ts
10 documented symbols. Read the signatures first, then expand each item for parameters, return types, and 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
Parameters
-
config{ layouts: Record<string, ThemeComponent>; defaultLayout?: string } -
config.layoutsRecord<string, ThemeComponent> -
config.defaultLayout?stringoptional
Returns
Examples
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
Parameters
-
paramThemeProps
Returns
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>
Parameters
-
pagesPageData[]All pages
-
outDirstringOutput directory for types
Returns
Promise<void>
interfacePageDataPage data for rendering.
Page data for rendering.
Signature
export interface PageData
Members
Properties
| Name | Type | Description |
|---|---|---|
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>>
Parameters
-
pagesPageData[]All pages to render
-
optionsThemeRenderOptionsTheme render options
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
Parameters
-
pagePageDataPage data to render
-
optionsThemeRenderOptionsTheme render options
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.
typeThemeComponent = (props: ThemeProps) => JSXNodeTheme component type.
Theme component type.
Signature
export type ThemeComponent = (props: ThemeProps) => JSXNode
Parameters
-
propsThemeProps
Returns
interfaceThemePropsProps passed to the theme component.
Props passed to the theme component.
Signature
export interface ThemeProps
Members
Properties
| Name | Type | Description |
|---|---|---|
children |
JSXNode |
Rendered page content as JSX |
interfaceThemeRenderOptionsTheme render options.
Theme render options.
Signature
export interface ThemeRenderOptions
Members
Properties
| Name | Type | Description |
|---|---|---|
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
|
typesOutDiroptional |
string |
Output directory for type definitions |