code-colors-react
Version:
Code syntax highlighting React component
22 lines (21 loc) • 756 B
TypeScript
import * as React from "react";
import type { Token } from "code-colors/lib";
export type DecorateToken = (token: Token, children: React.ReactNode, lang: string, code: string, pos: number) => React.ReactNode;
export interface MarkupProps {
code: string;
as?: string;
lang?: string;
prefix?: string;
/**
* Render a placeholder while the code is being parsed. Ir not provided,
* the code will be rendered as-is with reduced opacity.
*/
renderWaiting?: (props: MarkupProps) => React.ReactNode;
/**
* A wrapper function which allows to decorate the token with additional
* JSX elements.
*/
decorate?: DecorateToken;
[key: string]: unknown;
}
export declare const Markup: React.FC<MarkupProps>;