Home / Function/ renderToStaticMarkup() — astro Function Reference

renderToStaticMarkup() — astro Function Reference

Architecture documentation for the renderToStaticMarkup() function in server.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  79642f51_2a06_53f6_7930_c8dbea843fa1["renderToStaticMarkup()"]
  f962dc34_e372_47ee_1cd5_191f3430c796["server.ts"]
  79642f51_2a06_53f6_7930_c8dbea843fa1 -->|defined in| f962dc34_e372_47ee_1cd5_191f3430c796
  style 79642f51_2a06_53f6_7930_c8dbea843fa1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/custom-renderer/src/custom-renderer/server.ts lines 21–33

async function renderToStaticMarkup(
	this: RendererContext,
	Component: any,
	props: Record<string, any>,
	//{ default: children, ...slotted }: Record<string, any>,
	//metadata: AstroComponentMetadata | undefined,
) {		
	// in a real-world scenario, this would be a more complex function
	// actually rendering the components return value (which might be an AST/VDOM)
	// and render it as an HTML string
	const vdom = Component(props);
	return { attrs: {}, html: `<${vdom.tag}>${vdom.text} (rendered by server.ts)</${vdom.tag}>` };
}

Subdomains

Frequently Asked Questions

What does renderToStaticMarkup() do?
renderToStaticMarkup() is a function in the astro codebase, defined in packages/astro/test/fixtures/custom-renderer/src/custom-renderer/server.ts.
Where is renderToStaticMarkup() defined?
renderToStaticMarkup() is defined in packages/astro/test/fixtures/custom-renderer/src/custom-renderer/server.ts at line 21.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free