environment.ts
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.
Parameters
-
_optionsResolvedOptions
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
Parameters
-
optionsResolvedOptions
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.
Parameters
-
ctxEnvironmentTransformContext -
optionsResolvedOptions
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.
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.
Parameters
-
filesstring[] -
_optionsResolvedOptions
Returns
Promise