How to use the react-syntax-highlighter/dist/cjs/light.registerLanguage function in react-syntax-highlighter

To help you get started, we’ve selected a few react-syntax-highlighter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vmware-tanzu / octant / web / react / src / components / YAML / index.tsx View on Github external
import { YAMLViewerModel } from 'models'
import React, { Component } from 'react'
import yaml from 'react-syntax-highlighter/dist/cjs/languages/hljs/yaml'
import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'
import atomOneDark from 'react-syntax-highlighter/dist/cjs/styles/hljs/atom-one-dark'

import './styles.scss'

interface Props {
  view: YAMLViewerModel
}

SyntaxHighlighter.registerLanguage('yaml', yaml)

export default class extends Component {
  constructor(props: Props) {
    super(props)
  }

  render() {
    const { view } = this.props
    return (
      <div>
        
          {view.data}
        
      </div>
    )
  }