mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Add react-highlight.js
This commit is contained in:
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for react-highlight.js 1.0
|
||||
// Project: https://github.com/bvaughn/react-highlight.js
|
||||
// Definitions by: Christian Murphy <https://github.com/ChristianMurphy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { ComponentClass, ReactNode } from "react";
|
||||
|
||||
/**
|
||||
* Props for a Highlight component.
|
||||
*/
|
||||
export interface HighlightProps {
|
||||
/**
|
||||
* Language name to use as a class to signal type to highlight.js.
|
||||
*/
|
||||
language: string;
|
||||
|
||||
/**
|
||||
* Content that will be highlighted
|
||||
*/
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* A lightweight React wrapper around the Highlight.js syntax highlighting library.
|
||||
*/
|
||||
declare const Highlight: ComponentClass<HighlightProps>;
|
||||
|
||||
export default Highlight;
|
||||
@@ -0,0 +1,9 @@
|
||||
import * as React from "react";
|
||||
import Highlight from "react-highlight.js";
|
||||
|
||||
export const _ = () => <>
|
||||
<Highlight language="javascript" />
|
||||
<Highlight language="typescript">
|
||||
`console.log("Hello, world!");`
|
||||
</Highlight>
|
||||
</>;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-highlight.js-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user