2.5.6 • Published 1 year ago

rc-highlight v2.5.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

Sample result:

Installation

react-highlight is available as an npm package.

// with npm
npm i rc-highlight

// or yran
yarn add rc-highlight

Usage

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

Edit Button

import "./styles.css";
import { Highligther } from "rc-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
copyToClipBoardIf true, a button to copy the code to clipboard will be visibletrue

License

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

1.2.4

1 year ago

1.2.2

1 year ago

2.5.0

1 year ago

2.3.2

1 year ago

2.4.0

1 year ago

2.5.2

1 year ago

2.3.4

1 year ago

2.4.2

1 year ago

2.2.4

1 year ago

2.5.4

1 year ago

2.3.6

1 year ago

2.4.4

1 year ago

2.2.6

1 year ago

2.5.6

1 year ago

2.3.8

1 year ago

2.4.6

1 year ago

2.3.7

1 year ago

2.2.8

1 year ago

2.4.8

1 year ago

2.0.0

1 year ago

1.3.0

2 years ago

1.2.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago