3.0.1 • Published 9 months ago

react-code-container v3.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
9 months ago

react-code-container

NPM JavaScript Style Guide

image

Install

npm install --save react-code-container

Usage

import React, { useState } from 'react';
import 'react-code-container/dist/styles/base.css';
import 'highlight.js/styles/atom-one-dark.css'; // Find any highlight style you need
import ReactCodeContainer from 'react-code-container';

export default () => {
  const [language, setLanguage] = useState('jsx');
  const [showLineNumber, setShowLineNumber] = useState(true);

  const code = `export function hello() => {
    console.log("Hello world")
  }`;
  return (
    <ReactCodeContainer
      code={code}
      showLineNumber={showLineNumber} // optional
      language={language} // optional
      onLineNumberClick={handleLineNumberClicked} // optional
    />
  );
};

Configuration

OptionRequiredDefaultDescription
coderequiredYour code which want to display
showLineNumberoptionaltrueYou can turn on / off line number
languageoptionalLeave empty will use auto detect
onLineNumberClickoptionalThe callback function if you clicked lineNumber

License

MIT © Kun Yan

3.0.1

9 months ago

3.0.0

9 months ago

2.0.0-rc.2

12 months ago

2.0.0-rc.3

12 months ago

2.0.0-rc.4

12 months ago

2.0.0-rc.5

12 months ago

2.0.0-rc.1

12 months ago

2.0.0-rc.6

12 months ago

2.0.0-rc.7

12 months ago

2.0.0-rc.8

12 months ago

2.0.0

12 months ago

2.0.0-rc.9

12 months ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago