Syntax highlighting for jsx in .js files?

Hi David!

We might consider using the text/jsx highlight as the default for JavaScript files, but we aren’t sure yet. In the meantime, you can use one of these bookmarklets (copy’n’paste the following scripts in two separate bookmark URLs and put them in your bookmark bar) to change the mode of the current file to jsx manually :slight_smile:

  1. Temporarily change the highlight of the current file to jsx (you would need to click on the bookmark every time you switch files):
javascript:(function() {
  application.editor().setOption("mode", "text/jsx");
  CodeMirror.autoLoadMode(application.editor(), "jsx");
})()
  1. Change the highlight of all JavaScript files to jsx for the current editing session (you only need to click on the bookmark when you go the editor, the highlight remains until you reload or close the page):
javascript:(function() {
  CodeMirror.findModeByName("js").mime = "text/jsx";
  CodeMirror.findModeByName("js").mode = "jsx";
  application.editor().setOption("mode", "text/jsx");
  CodeMirror.autoLoadMode(application.editor(), "jsx");
})()
1 Like