How to use the react-syntax-highlighter.PrismAsyncLight.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 oslabs-beta / preducks / src / components / CodePreview.tsx View on Github external
import React, { Component } from 'react';
import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter';
import jsx from 'react-syntax-highlighter/dist/esm/languages/prism/jsx';
import { dark as style } from 'react-syntax-highlighter/dist/esm/styles/prism';
import { formatter } from '../utils/formatter.util';
import componentRender from '../utils/componentRender.util';
import { ComponentInt, ComponentsInt } from '../utils/InterfaceDefinitions';

SyntaxHighlighter.registerLanguage('jsx', jsx);
type Props = {
  focusComponent: ComponentInt;
  components: ComponentsInt;

class CodePreview extends Component {
  render(): JSX.Element {
    const focusComponent: ComponentInt = this.props.focusComponent;
    const components: ComponentsInt = this.props.components;
    return (