How to use the prismjs/components/prism-core.languages.jsx function in prismjs

To help you get started, we’ve selected a few prismjs 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 styled-components / styled-components-website / utils / prismTemplateString.js View on Github external
// NOTE: This highlights template-strings as strings of CSS
Prism.languages.insertBefore('jsx', 'template-string', {
  'styled-template-string': {
    pattern: /(styled(\.\w+|\([^\)]*\))(\.\w+(\([^\)]*\))*)*|css|injectGlobal|createGlobalStyle|keyframes|\.extend|\.withComponent)`(?:\$\{[^}]+\}|\\\\|\\?[^\\])*?`/,
    lookbehind: true,
    greedy: true,
    inside: {
      interpolation: {
        pattern: /\$\{[^}]+\}/,
        inside: {
          'interpolation-punctuation': {
            pattern: /^\$\{|\}$/,
            alias: 'punctuation',
          },
          rest: languages.jsx,
        },
      },
      string: {
        pattern: /[^$;]+/,
        inside: languages.css,
        alias: 'language-css',
      },
    },
  },
});

export { languages };
github expo / snack-web / snack / components / Editor / SimpleEditor.js View on Github external
_highlight = code => {
    if (this.props.path.endsWith('.js')) {
      return highlight(code, languages.jsx);
    } else if (this.props.path.endsWith('.json')) {
      return highlight(code, languages.json);
    } else if (this.props.path.endsWith('.md')) {
      return highlight(code, languages.markdown);
    }

    return escape(code);
  };
github expo / snack-web / src / client / components / Editor / SimpleEditor.tsx View on Github external
_highlight = (code: string) => {
    if (this.props.path.endsWith('.ts') || this.props.path.endsWith('.tsx')) {
      return highlight(code, languages.ts);
    } else if (this.props.path.endsWith('.js')) {
      return highlight(code, languages.jsx);
    } else if (this.props.path.endsWith('.json')) {
      return highlight(code, languages.json);
    } else if (this.props.path.endsWith('.md')) {
      return highlight(code, languages.markdown);
    }

    return escape(code);
  };
github expo / snack-web / src / client / components / Markdown / MarkdownPreview.tsx View on Github external
highlight: (code, lang) => {
        const grammar = lang === 'js' ? languages.jsx : languages[lang];
        return grammar ? highlight(code, grammar) : escape(code);
      },
    });
github satya164 / react-simple-code-editor / example / App.js View on Github external
              highlight={code => highlight(code, languages.jsx)}
              padding={10}