React JSX

To use this language, use the class "language-jsx".

Full example

var ExampleApplication = React.createClass({
    render: function() {
      var elapsed = Math.round(this.props.elapsed  / 100);
      var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
      var message =
        'React has been successfully running for ' + seconds + ' seconds.';

      return <p>{message}</p>;
    }
  });
  var start = new Date().getTime();
  setInterval(function() {
    React.render(
      <ExampleApplication elapsed={new Date().getTime() - start} />,
      document.getElementById('container')
    );
  }, 50);

Known failures

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. However, Prism dares to be open and honest about them. If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.

Comment-like substrings

"foo /* bar */ baz"; "foo // bar";

Two quotes of the same type (i.e. both single or both double) inside a regex

foo = /"foo"/;