Home / File/ content.ts — astro Source File

content.ts — astro Source File

Architecture documentation for content.ts, a typescript file in the astro codebase. 6 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 6 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  7547ecbb_58ef_bc2d_b119_f58ad78d86f6["content.ts"]
  b1ad5044_5dee_93fa_9942_3365c09d93c8["../../content/data-store.js"]
  7547ecbb_58ef_bc2d_b119_f58ad78d86f6 --> b1ad5044_5dee_93fa_9942_3365c09d93c8
  2c4472b4_85ad_f581_f6ca_e0da7470e997["../../content/loaders/errors.js"]
  7547ecbb_58ef_bc2d_b119_f58ad78d86f6 --> 2c4472b4_85ad_f581_f6ca_e0da7470e997
  9e624f62_bcfa_4352_e9a0_dd454823f706["../../runtime/server/index.js"]
  7547ecbb_58ef_bc2d_b119_f58ad78d86f6 --> 9e624f62_bcfa_4352_e9a0_dd454823f706
  c32d12e2_d85e_28c0_eea7_9b29629857e0["../types/public/config.js"]
  7547ecbb_58ef_bc2d_b119_f58ad78d86f6 --> c32d12e2_d85e_28c0_eea7_9b29629857e0
  82f345a2_2234_43f1_c3c4_eea191acdca8["markdown-remark"]
  7547ecbb_58ef_bc2d_b119_f58ad78d86f6 --> 82f345a2_2234_43f1_c3c4_eea191acdca8
  4454efd2_ab89_97b9_11ec_53ebe0d2f5ce["rollup"]
  7547ecbb_58ef_bc2d_b119_f58ad78d86f6 --> 4454efd2_ab89_97b9_11ec_53ebe0d2f5ce
  style 7547ecbb_58ef_bc2d_b119_f58ad78d86f6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { MarkdownHeading } from '@astrojs/markdown-remark';
import type * as rollup from 'rollup';
import type { DataEntry, RenderedContent } from '../../content/data-store.js';
import type { LiveCollectionError } from '../../content/loaders/errors.js';
import type { AstroComponentFactory } from '../../runtime/server/index.js';
import type { AstroConfig } from './config.js';

export interface AstroInstance {
	file: string;
	url: string | undefined;
	default: AstroComponentFactory;
}

export interface MarkdownInstance<T extends Record<string, any>> {
	frontmatter: T;
	/** Absolute file path (e.g. `/home/user/projects/.../file.md`) */
	file: string;
	/** Browser URL for files under `/src/pages` (e.g. `/en/guides/markdown-content`) */
	url: string | undefined;
	/** Component to render content in `.astro` files. Usage: `<Content />` */
	Content: AstroComponentFactory;
	/** raw Markdown file content, excluding layout HTML and YAML frontmatter */
	rawContent(): string;
	/** Markdown file compiled to HTML, excluding layout HTML */
	compiledContent(): Promise<string>;
	/** List of headings (h1 -> h6) with associated metadata */
	getHeadings(): MarkdownHeading[];
	default: AstroComponentFactory;
}

export interface MDXInstance<T extends Record<string, any>>
	extends Omit<MarkdownInstance<T>, 'rawContent' | 'compiledContent'> {
	components: Record<string, AstroComponentFactory> | undefined;
}

/**
 * Props accepted by the MDX `Content` component when using `await render()`.
 * Allows passing custom components to override default MDX element rendering.
 *
 * @example
 * ```astro
 * ---
 * import { getEntry, render } from 'astro:content';
 * import MyCustomH1 from '../components/CustomHeading.astro';
 * import MyImage from '../images/MyImage.jpg';
 * const entry = await getEntry('blog', 'post');
 * const { Content } = await render(entry);
 * ---
 * <Content components={{ h1: MyCustomH1, img: MyImage }} />
 * ```
 */
export interface MDXContentProps {
	/** Custom components to use for MDX elements (e.g., h1, h2, img, a, etc.) */
	components?: Record<string, AstroComponentFactory>;
	/** Any additional props to pass to the MDX content */
	[key: string]: any;
}

/**
 * The MDX `Content` component returned from `await render()`.
// ... (141 more lines)

Domain

Subdomains

Functions

Dependencies

  • ../../content/data-store.js
  • ../../content/loaders/errors.js
  • ../../runtime/server/index.js
  • ../types/public/config.js
  • markdown-remark
  • rollup

Frequently Asked Questions

What does content.ts do?
content.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in content.ts?
content.ts defines 2 function(s): entry, props.
What does content.ts depend on?
content.ts imports 6 module(s): ../../content/data-store.js, ../../content/loaders/errors.js, ../../runtime/server/index.js, ../types/public/config.js, markdown-remark, rollup.
Where is content.ts in the architecture?
content.ts is located at packages/astro/src/types/public/content.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/types/public).

Analyze Your Own Codebase

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

Try Supermodel Free