JSPM

  • Created
  • Published
  • Downloads 3598805
  • Score
    100M100P100Q205187F
  • License MIT

sane syntax highlighting component for react

Package Exports

  • react-syntax-highlighter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-syntax-highlighter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React Syntax Highlighter

Syntax highlighting component for React using the seriously amazing lowlight by wooorm

Work in progress - tests/demo coming soon.

Install

npm install react-syntax-highlighter --save

Use

props

language - the language to highlight code in. children - the code to highlight.

You will also need to include a highlight.js stylesheet for the syntax highlighting.

import SyntaxHighlighter from 'react-syntax-highlighter';
const Component = () => {
  const codeString = '(num) => num + 1';
  return <SyntaxHighlighter language='javascript'>{codeString}</SyntaxHighlighter>;  
}