Home / Function/ createGetHeadings() — astro Function Reference

createGetHeadings() — astro Function Reference

Architecture documentation for the createGetHeadings() function in runtime.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  01ba618d_a7bb_157f_c696_1b6d9dc801bd["createGetHeadings()"]
  df14bb08_8e2c_26c3_53bb_884062fbbac0["runtime.ts"]
  01ba618d_a7bb_157f_c696_1b6d9dc801bd -->|defined in| df14bb08_8e2c_26c3_53bb_884062fbbac0
  39c22968_8973_3448_9bdf_cafdfc963bbc["setupConfigSync()"]
  01ba618d_a7bb_157f_c696_1b6d9dc801bd -->|calls| 39c22968_8973_3448_9bdf_cafdfc963bbc
  4e652fe4_0ba8_1916_bc44_653f51aece72["collectHeadings()"]
  01ba618d_a7bb_157f_c696_1b6d9dc801bd -->|calls| 4e652fe4_0ba8_1916_bc44_653f51aece72
  style 01ba618d_a7bb_157f_c696_1b6d9dc801bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/markdoc/src/runtime.ts lines 201–217

export function createGetHeadings(
	stringifiedAst: string,
	userConfig: AstroMarkdocConfig,
	options: MarkdocIntegrationOptions | undefined,
) {
	return function getHeadings() {
		/* Yes, we are transforming twice (once from `getHeadings()` and again from <Content /> in case of variables).
			TODO: propose new `render()` API to allow Markdoc variable passing to `render()` itself,
			instead of the Content component. Would remove double-transform and unlock variable resolution in heading slugs. */
		const config = setupConfigSync(userConfig, options);
		const ast = Markdoc.Ast.fromJSON(stringifiedAst);
		const content = Markdoc.transform(ast as Node, config as ConfigType);
		let collectedHeadings: MarkdownHeading[] = [];
		collectHeadings(Array.isArray(content) ? content : [content], collectedHeadings);
		return collectedHeadings;
	};
}

Domain

Subdomains

Frequently Asked Questions

What does createGetHeadings() do?
createGetHeadings() is a function in the astro codebase, defined in packages/integrations/markdoc/src/runtime.ts.
Where is createGetHeadings() defined?
createGetHeadings() is defined in packages/integrations/markdoc/src/runtime.ts at line 201.
What does createGetHeadings() call?
createGetHeadings() calls 2 function(s): collectHeadings, setupConfigSync.

Analyze Your Own Codebase

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

Try Supermodel Free