Ox Content

environment.ts

Source

createMarkdownEnvironment

function

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

Source

export function createMarkdownEnvironment(
  options: ResolvedOptions
  ): EnvironmentOptions

Returns

EnvironmentOptions -

Examples

// In your vite.config.ts
export default defineConfig({
  environments: {
    markdown: createMarkdownEnvironment({
      srcDir: 'docs',
      gfm: true,
    }),
  },
});

EnvironmentTransformContext

interface

Environment-specific module transformer. This is called during the transform phase to process Markdown files within the environment context.

Source


createTransformOptions

function

Creates environment-aware transform options.

Source

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

Returns

ResolvedOptions -


prerender

function

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

Source

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

Returns

Promise<Map<string, string>> -


createEnvironmentPlugins

function

Environment plugin factory. Creates plugins specific to the Markdown environment.

Source

export function createEnvironmentPlugins(_options: ResolvedOptions)