Home / File/ shiki.ts — astro Source File

shiki.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 3 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  f102b00b_404a_a2b2_3274_44ec121e3e59["shiki.ts"]
  2ebb1f90_a903_fafc_eb9b_ce29b5c61608["./types.js"]
  f102b00b_404a_a2b2_3274_44ec121e3e59 --> 2ebb1f90_a903_fafc_eb9b_ce29b5c61608
  f76e2597_e3e8_c502_d293_a666b44d49ce["hast"]
  f102b00b_404a_a2b2_3274_44ec121e3e59 --> f76e2597_e3e8_c502_d293_a666b44d49ce
  0302dbcf_dad6_6bb1_3d2f_5c90fa9a96d4["shiki"]
  f102b00b_404a_a2b2_3274_44ec121e3e59 --> 0302dbcf_dad6_6bb1_3d2f_5c90fa9a96d4
  style f102b00b_404a_a2b2_3274_44ec121e3e59 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { Properties, Root } from 'hast';
import {
	type BundledLanguage,
	type BundledTheme,
	createCssVariablesTheme,
	createHighlighter,
	type HighlighterCoreOptions,
	type HighlighterGeneric,
	isSpecialLang,
	type LanguageRegistration,
	type ShikiTransformer,
	type ThemeRegistration,
	type ThemeRegistrationRaw,
} from 'shiki';
import type { ThemePresets } from './types.js';

export interface ShikiHighlighter {
	codeToHast(
		code: string,
		lang?: string,
		options?: ShikiHighlighterHighlightOptions,
	): Promise<Root>;
	codeToHtml(
		code: string,
		lang?: string,
		options?: ShikiHighlighterHighlightOptions,
	): Promise<string>;
}

export interface CreateShikiHighlighterOptions {
	langs?: LanguageRegistration[];
	theme?: ThemePresets | ThemeRegistration | ThemeRegistrationRaw;
	themes?: Record<string, ThemePresets | ThemeRegistration | ThemeRegistrationRaw>;
	langAlias?: HighlighterCoreOptions['langAlias'];
}

export interface ShikiHighlighterHighlightOptions {
	/**
	 * Generate inline code element only, without the pre element wrapper.
	 */
	inline?: boolean;
	/**
	 * Enable word wrapping.
	 * - true: enabled.
	 * - false: disabled.
	 * - null: All overflow styling removed. Code will overflow the element by default.
	 */
	wrap?: boolean | null;
	/**
	 * Chooses a theme from the "themes" option that you've defined as the default styling theme.
	 */
	defaultColor?: 'light' | 'dark' | string | false;
	/**
	 * Shiki transformers to customize the generated HTML by manipulating the hast tree.
	 */
	transformers?: ShikiTransformer[];
	/**
	 * Additional attributes to be added to the root code block element.
	 */
	attributes?: Record<string, string>;
// ... (160 more lines)

Domain

Subdomains

Dependencies

  • ./types.js
  • hast
  • shiki

Frequently Asked Questions

What does shiki.ts do?
shiki.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 shiki.ts?
shiki.ts defines 3 function(s): createShikiHighlighter, cssVariablesTheme, normalizePropAsString.
What does shiki.ts depend on?
shiki.ts imports 3 module(s): ./types.js, hast, shiki.
Where is shiki.ts in the architecture?
shiki.ts is located at packages/markdown/remark/src/shiki.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