Add react-highlight.js

This commit is contained in:
Christian Murphy
2019-04-16 12:20:10 -07:00
parent 0afc95fdd4
commit d622d1b737
4 changed files with 63 additions and 0 deletions
+29
View File
@@ -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>
</>;
+24
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }