2.0.0 • Published 4 years ago

@unlimited-react-components/react-highlight v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

license npm latest package install size Coverage Status Build Status Known Vulnerabilities Total alerts Language grade: JavaScript

Sample result:

Installation

react-highlight is available as an npm package.

// with npm
npm i @unlimited-react-components/react-highlight

// or yran
yarn add @unlimited-react-components/react-highlight

Usage

Here is a quick example to get you started, it's all you need:

Edit Button

import "./styles.css";
import { Highligther } from "@unlimited-react-components/react-highlight";

const App = (props) => {
  return <Highlighter>{makeCode}</Highlighter>;
};
export default App;
const makeCode = `
    // this is a sample code
    const themes = {
      light: { ... },
      dark:  { ... }
    };
    const ThemeContext = React.createContext(themes.light);
    function App() {
      return (
        <ThemeContext.Provider value={themes.dark}>
          <Toolbar />
        </ThemeContext.Provider>
      );
    }
    function Toolbar(props) { ... }
    
    const ThemedButton =() => { ... }
`;

Props

NameDescriptionDefault
codeThe JSX code to be highlighted.""
styleThe in-line CSS object. Only affects the container{ }
childrenThe JSX code to be highlighted in string format.""
onCopyToClipboardA Funtion that is triggered when copy to clipboard button is clicked. Returns the copied code as a string as first parameter.undefined

License

This project is licensed under the terms of the MIT license.

2.0.0

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago