environment.ts

Source

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

6 symbols 4 functions 1 interfaces 1 modules 6 parameters 4 members 3 returns 1 examples

Reference

fncreateEnvironmentPlugins(options: ResolvedOptions)Environment plugin factory. Creates plugins specific to the Markdown environmen…

Environment plugin factory.

Creates plugins specific to the Markdown environment.

Signature

export function createEnvironmentPlugins(options: ResolvedOptions)

View source

Parameters

fncreateMarkdownEnvironment(options: ResolvedOptions): EnvironmentOptionsCreates the Markdown processing environment configuration. This environment is…

Creates the Markdown processing environment configuration.

This environment is used for:

  • Server-side rendering of Markdown files
  • Static site generation
  • Pre-rendering at build time

Signature

export function createMarkdownEnvironment(options: ResolvedOptions): EnvironmentOptions

View source

Parameters

Returns

EnvironmentOptions

Examples

Example 1
// In your vite.config.ts
export default defineConfig({
  environments: {
    markdown: createMarkdownEnvironment({
      srcDir: 'content',
      gfm: true,
    }),
  },
});
fncreateTransformOptions(ctx: EnvironmentTransformContext, options: ResolvedOptions): ResolvedOptionsCreates environment-aware transform options.

Creates environment-aware transform options.

Signature

export function createTransformOptions(ctx: EnvironmentTransformContext, options: ResolvedOptions): ResolvedOptions

View source

Parameters

Returns

ResolvedOptions
moduleenvironmentVite Environment API integration for Ox Content. Creates a dedicated environment for Markdown processing, enabling SSG-…

Vite Environment API integration for Ox Content.

Creates a dedicated environment for Markdown processing, enabling SSG-style rendering with separate client/server contexts.

View source

interfaceEnvironmentTransformContextEnvironment-specific module transformer. This is called during the transform ph…

Environment-specific module transformer.

This is called during the transform phase to process Markdown files within the environment context.

Signature

export interface EnvironmentTransformContext

View source

Members

Properties
NameTypeDescription
config unknown
The resolved Vite config.
environment string
Current environment name.
isDev boolean
Whether we're in development mode.
isSSR boolean
Whether this is a server-side render.
fnprerender(files: string[], _options: ResolvedOptions): Promise<Map<string, string>>Runs pre-render for SSG. This function is called during build to pre-render all…

Runs pre-render for SSG.

This function is called during build to pre-render all Markdown files.

Signature

export async function prerender(files: string[], _options: ResolvedOptions): Promise<Map<string, string>>

View source

Parameters

Returns

Promise<Map<string, string>>