Code
A JSX email component which displays a syntax-highlighted code block using Shiki
Install
Install the component from your command line
pnpm add jsx-emailbun add jsx-emailnpm add jsx-emailyarn add jsx-emailUsage
import { Code } from 'jsx-email';
const Email = () => { return ( <Code language="javascript"> {` import { batman } from 'superheros'; import { joker } from 'villains';
const henchmen = joker.help();
batman.fight(henchmen); batman.arrest(joker); `} </Code> );};Props
Required Props
language
language: string;Syntax highlighting language. See shiki supported languages.
Optional Props
theme
theme?: string;Color theme for syntax highlighting. Defaults to 'nord'. See shiki themes documentation.
Additional Props
This component also expresses all of the Common Component Props for ComponentProps<'pre'>.