How to use the prism-react-renderer/themes/dracula.plain function in prism-react-renderer

To help you get started, we’ve selected a few prism-react-renderer 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 wilsson / papyrum / packages / papyrum-ui-docs / src / components / Playground / Playground.tsx View on Github external
export const Playground = ({ code: initialCode, scope }) => {
  const [ code, setCode ] = useState(initialCode);
  const [ clip, setClip ] = useState(false);
  const { db: { config } } = useContext(contextDB as any);
  const stylesPlain = (config.prism && config.prism.theme.plain) || dracula.plain;
  const handleClipboard = () => {
    copy(code);
    setClip(true);
    setTimeout(() => setClip(false), 500);
  };

  const highlight = code => (
    
      {({ className, style, tokens, getLineProps, getTokenProps }) => (
        
          {tokens.map((line, i) => (
github wilsson / papyrum / packages / papyrum-ui / src / components / Highlight / Highlight.tsx View on Github external
export const Highlight: React.FC = ({ code }) => {
  const [ clip, setClip ] = useState(false);
  const { db: { config } } = useContext(contextDB as any);
  const stylesPlain = (config.prism && config.prism.theme.plain) || dracula.plain;

  const handleClipboard = () => {
    copy(code);
    setClip(true);
    setTimeout(() => setClip(false), 400);
  };

  return(
    
      {({ tokens, getLineProps, getTokenProps, style, className }) => {
        return(

prism-react-renderer

Renders highlighted Prism output using React

MIT
Latest version published 5 months ago

Package Health Score

90 / 100
Full package analysis

Similar packages