environment.ts
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
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.
createTransformOptions
function
Creates environment-aware transform options.
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.
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.
export function createEnvironmentPlugins(_options: ResolvedOptions)