renderToStaticMarkup() — astro Function Reference
Architecture documentation for the renderToStaticMarkup() function in server.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 486462f5_72a7_e244_cbe3_b9dae122099e["renderToStaticMarkup()"] e59bec1a_ac20_e899_75d6_a672374af970["server.ts"] 486462f5_72a7_e244_cbe3_b9dae122099e -->|defined in| e59bec1a_ac20_e899_75d6_a672374af970 6955bffa_4885_a4a1_737e_6865719e1c47["needsHydration()"] 486462f5_72a7_e244_cbe3_b9dae122099e -->|calls| 6955bffa_4885_a4a1_737e_6865719e1c47 style 486462f5_72a7_e244_cbe3_b9dae122099e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/integrations/svelte/src/server.ts lines 22–68
async function renderToStaticMarkup(
this: RendererContext,
Component: any,
props: Record<string, any>,
slotted: Record<string, any>,
metadata?: AstroComponentMetadata,
) {
const tagName = needsHydration(metadata) ? 'astro-slot' : 'astro-static-slot';
let children = undefined;
let $$slots: Record<string, any> | undefined = undefined;
let idPrefix;
if (this && this.result) {
idPrefix = incrementId(this.result);
}
const renderProps: Record<string, any> = {};
for (const [key, value] of Object.entries(slotted)) {
// Legacy slot support
$$slots ??= {};
if (key === 'default') {
$$slots.default = true;
children = createRawSnippet(() => ({
render: () => `<${tagName}>${value}</${tagName}>`,
}));
} else {
$$slots[key] = createRawSnippet(() => ({
render: () => `<${tagName} name="${key}">${value}</${tagName}>`,
}));
}
// @render support for Svelte ^5.0
const slotName = key === 'default' ? 'children' : key;
renderProps[slotName] = createRawSnippet(() => ({
render: () => `<${tagName}${key !== 'default' ? ` name="${key}"` : ''}>${value}</${tagName}>`,
}));
}
const result = await render(Component, {
props: {
...props,
children,
$$slots,
...renderProps,
},
idPrefix,
});
return { html: result.body };
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does renderToStaticMarkup() do?
renderToStaticMarkup() is a function in the astro codebase, defined in packages/integrations/svelte/src/server.ts.
Where is renderToStaticMarkup() defined?
renderToStaticMarkup() is defined in packages/integrations/svelte/src/server.ts at line 22.
What does renderToStaticMarkup() call?
renderToStaticMarkup() calls 1 function(s): needsHydration.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free