UNPKG

react-shiki

Version:

Syntax highlighter component for react using shiki

40 lines (37 loc) 1.5 kB
import * as react from 'react'; import { S as ShikiHighlighterProps, U as UseShikiHighlighter } from './component-mMdHg8JD.js'; export { E as Element, H as HighlighterOptions, L as Language, T as Theme, a as Themes, i as isInlineCode, r as rehypeInlineCodeProperty } from './component-mMdHg8JD.js'; export { createJavaScriptRawEngine, createJavaScriptRegexEngine } from 'shiki/engine/javascript'; import 'shiki'; import 'shiki/core'; import 'hast'; /** * Highlight code with shiki (full bundle) * * @param code - Code to highlight * @param lang - Language (bundled or custom) * @param theme - Theme (bundled, multi-theme, or custom) * @param options - react-shiki options + shiki options * @returns Highlighted code as React elements or HTML string * * @example * ```tsx * const highlighted = useShikiHighlighter( * 'const x = 1;', * 'typescript', * { * light: 'github-light', * dark: 'github-dark' * } * ); * ``` * * Full bundle (~6.4MB minified, 1.2MB gzipped). For smaller bundles: `react-shiki/web` or `react-shiki/core` */ declare const useShikiHighlighter: UseShikiHighlighter; /** * ShikiHighlighter component using the full bundle. * Includes all languages and themes for maximum compatibility. */ declare const ShikiHighlighter: react.ForwardRefExoticComponent<ShikiHighlighterProps & react.RefAttributes<HTMLElement>>; export { ShikiHighlighter, ShikiHighlighterProps, UseShikiHighlighter, ShikiHighlighter as default, useShikiHighlighter };