@uiw/react-prismjs
TypeScript icon, indicating that this package has built-in type declarations

1.3.6 • Public • Published

@uiw/react-prismjs

Build & Deploy NPM Downloads npm version npm bundle size

React Component for prismjs. The current document website.

Install

npm i @uiw/react-prismjs

Basic Usage

Open in CodeSandbox

import ReactPrismjs from '@uiw/react-prismjs';
import 'prismjs/components/prism-java';

const Dome = () => (
  <ReactPrismjs language="java" source="java code string." />
);

Theme

Support prismjs theme setting

import ReactPrismjs from '@uiw/react-prismjs';
import 'prismjs/themes/prism-coy.css';

Options Props

interface ReactPrismjsProps {
  prefixCls?: string;
  language?: string;
  source?: string;
  className?: string;
}
  • source - string The code string source to parse (required)
  • language - string A language id in Prism.languages.
  • className - string Class name of the container element.

Development

development

Runs the project in development mode.

# listen to the component compile and output the .js file and listen for compilation output type .d.ts file
npm run watch
# development mode, listen to compile preview website instance
npm run doc:dev

Contributors

As always, thanks to our amazing contributors!

Made with github-action-contributors.

License

Licensed under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i @uiw/react-prismjs

Weekly Downloads

257

Version

1.3.6

License

MIT

Unpacked Size

19.6 kB

Total Files

13

Last publish

Collaborators

  • uiwjs
  • wcjiang