Home / Function/ rehypeShiki() — astro Function Reference

rehypeShiki() — astro Function Reference

Architecture documentation for the rehypeShiki() function in rehype-shiki.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  cabca723_c0f7_4393_b9e9_291acbb49b61["rehypeShiki()"]
  7bd3a558_f9fb_1400_68d9_87e777276501["rehype-shiki.ts"]
  cabca723_c0f7_4393_b9e9_291acbb49b61 -->|defined in| 7bd3a558_f9fb_1400_68d9_87e777276501
  style cabca723_c0f7_4393_b9e9_291acbb49b61 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/markdown/remark/src/rehype-shiki.ts lines 7–32

export const rehypeShiki: Plugin<[ShikiConfig, string[]?], Root> = (config, excludeLangs) => {
	let highlighterAsync: Promise<ShikiHighlighter> | undefined;

	return async (tree) => {
		highlighterAsync ??= createShikiHighlighter({
			langs: config?.langs,
			theme: config?.theme,
			themes: config?.themes,
			langAlias: config?.langAlias,
		});
		const highlighter = await highlighterAsync;

		await highlightCodeBlocks(
			tree,
			(code, language, options) => {
				return highlighter.codeToHast(code, language, {
					meta: options?.meta,
					wrap: config?.wrap,
					defaultColor: config?.defaultColor,
					transformers: config?.transformers,
				});
			},
			excludeLangs,
		);
	};
};

Domain

Subdomains

Frequently Asked Questions

What does rehypeShiki() do?
rehypeShiki() is a function in the astro codebase, defined in packages/markdown/remark/src/rehype-shiki.ts.
Where is rehypeShiki() defined?
rehypeShiki() is defined in packages/markdown/remark/src/rehype-shiki.ts at line 7.

Analyze Your Own Codebase

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

Try Supermodel Free