theme-renderer.ts
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.
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.
Parameters
-
paramThemeProps
Returns
JSXNode
fngenerateTypes(pages: PageData[], outDir: string): Promise<void>Generates TypeScript type definitions from page frontmatter.
Generates TypeScript type definitions from page frontmatter.
Parameters
-
pagesPageData[]All pages
-
outDirstringOutput directory for types
Returns
Promise
interfacePageDataPage data for rendering.
Page data for rendering.
fnrenderAllPages(pages: PageData[], options: ThemeRenderOptions): Promise<Map<string, string>>Renders all pages and generates type definitions.
Renders all pages and generates type definitions.
Parameters
-
pagesPageData[]All pages to render
-
optionsThemeRenderOptionsTheme 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.
Parameters
-
pagePageDataPage data to render
-
optionsThemeRenderOptionsTheme render options
Returns
string
Rendered HTML string
typeThemeComponent = (props: ThemeProps) => JSXNodeTheme component type.
Theme component type.
interfaceThemePropsProps passed to the theme component.
Props passed to the theme component.
interfaceThemeRenderOptionsTheme render options.
Theme render options.