Home / File/ types.ts — astro Source File

types.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 7 imports 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  c2c893bc_65c1_f3e6_50e6_2ebac4985a42["types.ts"]
  071212f5_2d93_d106_2e4e_681b5f27b774["./shiki.js"]
  c2c893bc_65c1_f3e6_50e6_2ebac4985a42 --> 071212f5_2d93_d106_2e4e_681b5f27b774
  21f9daf1_9979_0313_afee_bbb8465c9f69["remote"]
  c2c893bc_65c1_f3e6_50e6_2ebac4985a42 --> 21f9daf1_9979_0313_afee_bbb8465c9f69
  f76e2597_e3e8_c502_d293_a666b44d49ce["hast"]
  c2c893bc_65c1_f3e6_50e6_2ebac4985a42 --> f76e2597_e3e8_c502_d293_a666b44d49ce
  422b029d_9a4f_c23d_7f7e_340358545db4["mdast"]
  c2c893bc_65c1_f3e6_50e6_2ebac4985a42 --> 422b029d_9a4f_c23d_7f7e_340358545db4
  b5eedb63_b659_9ab6_0741_b5822edde660["remark-rehype"]
  c2c893bc_65c1_f3e6_50e6_2ebac4985a42 --> b5eedb63_b659_9ab6_0741_b5822edde660
  0302dbcf_dad6_6bb1_3d2f_5c90fa9a96d4["shiki"]
  c2c893bc_65c1_f3e6_50e6_2ebac4985a42 --> 0302dbcf_dad6_6bb1_3d2f_5c90fa9a96d4
  54ce55cc_9dc1_4ebd_28dd_358c1e22d4e7["unified"]
  c2c893bc_65c1_f3e6_50e6_2ebac4985a42 --> 54ce55cc_9dc1_4ebd_28dd_358c1e22d4e7
  style c2c893bc_65c1_f3e6_50e6_2ebac4985a42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { RemotePattern } from '@astrojs/internal-helpers/remote';
import type * as hast from 'hast';
import type * as mdast from 'mdast';
import type { Options as RemarkRehypeOptions } from 'remark-rehype';
import type { BuiltinTheme } from 'shiki';
import type * as unified from 'unified';
import type { CreateShikiHighlighterOptions, ShikiHighlighterHighlightOptions } from './shiki.js';

export type { Node } from 'unist';

declare module 'vfile' {
	interface DataMap {
		astro: {
			headings?: MarkdownHeading[];
			localImagePaths?: string[];
			remoteImagePaths?: string[];
			frontmatter?: Record<string, any>;
		};
	}
}

export type RemarkPlugin<PluginParameters extends any[] = any[]> = unified.Plugin<
	PluginParameters,
	mdast.Root
>;

export type RemarkPlugins = (string | [string, any] | RemarkPlugin | [RemarkPlugin, any])[];

export type RehypePlugin<PluginParameters extends any[] = any[]> = unified.Plugin<
	PluginParameters,
	hast.Root
>;

export type RehypePlugins = (string | [string, any] | RehypePlugin | [RehypePlugin, any])[];

export type RemarkRehype = RemarkRehypeOptions;

export type ThemePresets = BuiltinTheme | 'css-variables';

export type SyntaxHighlightConfigType = 'shiki' | 'prism';

export interface SyntaxHighlightConfig {
	type: SyntaxHighlightConfigType;
	excludeLangs?: string[];
}

export interface ShikiConfig
	extends Pick<CreateShikiHighlighterOptions, 'langs' | 'theme' | 'themes' | 'langAlias'>,
		Pick<ShikiHighlighterHighlightOptions, 'defaultColor' | 'wrap' | 'transformers'> {}

/**
 * Configuration options that end up in the markdown section of AstroConfig
 */
export interface AstroMarkdownOptions {
	syntaxHighlight?: SyntaxHighlightConfig | SyntaxHighlightConfigType | false;
	shikiConfig?: ShikiConfig;
	remarkPlugins?: RemarkPlugins;
	rehypePlugins?: RehypePlugins;
	remarkRehype?: RemarkRehype;
	gfm?: boolean;
	smartypants?: boolean;
}

/**
 * Extra configuration options from other parts of AstroConfig that get injected into this plugin
 */
export interface AstroMarkdownProcessorOptions extends AstroMarkdownOptions {
	image?: {
		domains?: string[];
		remotePatterns?: RemotePattern[];
	};
}

export interface MarkdownProcessor {
	render: (
		content: string,
		opts?: MarkdownProcessorRenderOptions,
	) => Promise<MarkdownProcessorRenderResult>;
}

export interface MarkdownProcessorRenderOptions {
	/** The URL of the file being rendered, used for resolving relative image paths */
	fileURL?: URL;
	/** Used for frontmatter injection plugins */
	frontmatter?: Record<string, any>;
}

export interface MarkdownProcessorRenderResult {
	code: string;
	metadata: {
		headings: MarkdownHeading[];
		localImagePaths: string[];
		remoteImagePaths: string[];
		frontmatter: Record<string, any>;
	};
}

export interface MarkdownHeading {
	depth: number;
	slug: string;
	text: string;
}

Domain

Subdomains

Functions

Classes

Dependencies

  • ./shiki.js
  • hast
  • mdast
  • remark-rehype
  • remote
  • shiki
  • unified

Frequently Asked Questions

What does types.ts do?
types.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 types.ts?
types.ts defines 1 function(s): content.
What does types.ts depend on?
types.ts imports 7 module(s): ./shiki.js, hast, mdast, remark-rehype, remote, shiki, unified.
Where is types.ts in the architecture?
types.ts is located at packages/markdown/remark/src/types.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/markdown/remark/src).

Analyze Your Own Codebase

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

Try Supermodel Free