Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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}
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',
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}
);
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}
);
};
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}
);
};