How to use the react-syntax-highlighter/dist/esm/prism-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 webhintio / hint / packages / extension-browser / src / devtools / views / controls / source-code.tsx View on Github external
import * as React from 'react';

import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';
import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
import http from 'react-syntax-highlighter/dist/esm/languages/prism/http';
import javascript from 'react-syntax-highlighter/dist/esm/languages/prism/javascript';
import xml from 'react-syntax-highlighter/dist/esm/languages/prism/markup';

import * as styles from './source-code.css';

// Explictly register languages so only those needed get bundled.
SyntaxHighlighter.registerLanguage('css', css);
SyntaxHighlighter.registerLanguage('http', http);
SyntaxHighlighter.registerLanguage('javascript', javascript);
SyntaxHighlighter.registerLanguage('xml', xml);

type Props = {
    children: any;
    language?: string;
};

const SourceCode = ({ children, language }: Props) => {
    const lang = language || 'html';

    return (
        
            {children}
github storybookjs / storybook / addons / cssresources / src / CssResourcePanel.js View on Github external
import { document, DOMParser } from 'global';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { monoFonts } from '@storybook/components';
import styled from '@emotion/styled';

import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
import { darcula } from 'react-syntax-highlighter/dist/esm/styles/prism';
import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';

SyntaxHighlighter.registerLanguage('css', css);

const storybookIframe = 'storybook-preview-iframe';
const addedElAttr = 'addedbycssresourcesaddon';

// Taken from StoryPanel.js
const highlighterTheme = {
  ...darcula,
  'pre[class*="language-"]': {
    ...darcula['pre[class*="language-"]'],
    margin: 'auto',
    width: 'auto',
    height: 'auto',
    minHeight: '100%',
    overflow: 'hidden',
    boxSizing: 'border-box',
    display: 'flex',
github webhintio / hint / packages / extension-browser / src / devtools / views / controls / source-code.tsx View on Github external
import * as React from 'react';

import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';
import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
import http from 'react-syntax-highlighter/dist/esm/languages/prism/http';
import javascript from 'react-syntax-highlighter/dist/esm/languages/prism/javascript';
import xml from 'react-syntax-highlighter/dist/esm/languages/prism/markup';

import * as styles from './source-code.css';

// Explictly register languages so only those needed get bundled.
SyntaxHighlighter.registerLanguage('css', css);
SyntaxHighlighter.registerLanguage('http', http);
SyntaxHighlighter.registerLanguage('javascript', javascript);
SyntaxHighlighter.registerLanguage('xml', xml);

type Props = {
    children: any;
    language?: string;
};

const SourceCode = ({ children, language }: Props) => {
    const lang = language || 'html';

    return (
        
            {children}
        
    );
github webhintio / hint / packages / extension-browser / src / devtools / views / controls / source-code.tsx View on Github external
import * as React from 'react';

import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';
import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
import http from 'react-syntax-highlighter/dist/esm/languages/prism/http';
import javascript from 'react-syntax-highlighter/dist/esm/languages/prism/javascript';
import xml from 'react-syntax-highlighter/dist/esm/languages/prism/markup';

import * as styles from './source-code.css';

// Explictly register languages so only those needed get bundled.
SyntaxHighlighter.registerLanguage('css', css);
SyntaxHighlighter.registerLanguage('http', http);
SyntaxHighlighter.registerLanguage('javascript', javascript);
SyntaxHighlighter.registerLanguage('xml', xml);

type Props = {
    children: any;
    language?: string;
};

const SourceCode = ({ children, language }: Props) => {
    const lang = language || 'html';

    return (
        
            {children}
        
    );
};
github webhintio / hint / packages / extension-browser / src / devtools / views / controls / source-code.tsx View on Github external
import * as React from 'react';

import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';
import css from 'react-syntax-highlighter/dist/esm/languages/prism/css';
import http from 'react-syntax-highlighter/dist/esm/languages/prism/http';
import javascript from 'react-syntax-highlighter/dist/esm/languages/prism/javascript';
import xml from 'react-syntax-highlighter/dist/esm/languages/prism/markup';

import * as styles from './source-code.css';

// Explictly register languages so only those needed get bundled.
SyntaxHighlighter.registerLanguage('css', css);
SyntaxHighlighter.registerLanguage('http', http);
SyntaxHighlighter.registerLanguage('javascript', javascript);
SyntaxHighlighter.registerLanguage('xml', xml);

type Props = {
    children: any;
    language?: string;
};

const SourceCode = ({ children, language }: Props) => {
    const lang = language || 'html';

    return (
        
            {children}
        
    );
};