environment.ts

Source

5 documented symbols. Read the signatures first, then expand each item for parameters, return types, and 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.

View source

Parameters

  • _options ResolvedOptions
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

View source

Parameters

  • options ResolvedOptions

Returns

EnvironmentOptions

Examples

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

View source

Parameters

  • ctx EnvironmentTransformContext
  • options ResolvedOptions

Returns

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

View source

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.

View source

Parameters

  • files string[]
  • _options ResolvedOptions

Returns

Promise