UNPKG

react-shiki

Version:

Syntax highlighter component for react using shiki

40 lines (37 loc) 1.49 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 (web 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' * } * ); * ``` * * Web bundle (~3.8MB minified, 695KB gzipped). For other bundles: `react-shiki` or `react-shiki/core` */ declare const useShikiHighlighter: UseShikiHighlighter; /** * ShikiHighlighter component using the web bundle. * Includes web-focused languages for balanced size and functionality. */ declare const ShikiHighlighter: react.ForwardRefExoticComponent<ShikiHighlighterProps & react.RefAttributes<HTMLElement>>; export { ShikiHighlighter, ShikiHighlighterProps, UseShikiHighlighter, ShikiHighlighter as default, useShikiHighlighter };