theme-renderer.ts

Source

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

View source

Parameters

  • config { ... }

Returns

ThemeComponent

Examples

import { createTheme } from '@ox-content/vite-plugin';
import { DefaultLayout } from './layouts/Default';
import { EntryLayout } from './layouts/Entry';
export default createTheme({
  layouts: {
    default: DefaultLayout,
    entry: EntryLayout,
  },
});
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.

View source

Parameters

  • param ThemeProps

Returns

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

Generates TypeScript type definitions from page frontmatter.

View source

Parameters

  • pages PageData[]

    All pages

  • outDir string

    Output directory for types

Returns

Promise
interfacePageDataPage data for rendering.

Page data for rendering.

View source

fnrenderAllPages(pages: PageData[], options: ThemeRenderOptions): Promise<Map<string, string>>Renders all pages and generates type definitions.

Renders all pages and generates type definitions.

View source

Parameters

  • pages PageData[]

    All pages to render

  • options ThemeRenderOptions

    Theme render options

Returns

Promise

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.

View source

Parameters

  • page PageData

    Page data to render

  • options ThemeRenderOptions

    Theme render options

Returns

string

Rendered HTML string

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

Theme component type.

View source

interfaceThemePropsProps passed to the theme component.

Props passed to the theme component.

View source

interfaceThemeRenderOptionsTheme render options.

Theme render options.

View source