Skip to content

Instantly share code, notes, and snippets.

@ktmud
Created August 26, 2020 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ktmud/3d796360534b3a103fd7406f6b6160e2 to your computer and use it in GitHub Desktop.
Save ktmud/3d796360534b3a103fd7406f6b6160e2 to your computer and use it in GitHub Desktop.
import {
ReactNode,
HTMLAttributes,
CSSProperties,
HTMLProps,
MutableRefObject,
FunctionComponent,
} from 'react';
declare module 'react-syntax-highlighter' {
export interface SyntaxHighlighterReactNode {
properties: HTMLAttributes<HTMLElement>;
type?: 'text';
tagName?: keyof HTMLElementTagNameMap;
}
export interface LightHighlighter extends FunctionComponent<SyntaxHighlighterProps> {
registerLanguage: (languageName: string, definition: object) => void;
}
export interface SyntaxHighlighterCodeRenderer {
(options: {
rows: SyntaxHighlighterReactNode[];
stylesheet: CSSProperties;
useInlineStyles: boolean;
}): ReactNode;
}
export interface SyntaxHighlighterProps {
renderer?: SyntaxHighlighterCodeRenderer;
// @ts-ignore
codeTagProps?: HTMLProps<HTMLElement> & { ref: MutableRefObject<HTMLElement> };
}
export function createElement(options: {
node: SyntaxHighlighterReactNode;
stylesheet: CSSProperties;
style?: Record<string, CSSProperties>;
useInlineStyles: boolean;
key: string;
}): ReactNode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment