Sublime Forum

How do I get proper react syntax highlight in text/babel scripts?

#1

React code in <script type="text/babel"> was not highlighted.

I followed the solution posted here: https://github.com/babel/babel-sublime/issues/291#issuecomment-280173863 and managed to get it highlighted.

But the highlighter breaks with HTML content in JS.

How do you guys get the proper syntax highlight?

This is the file I’m reading: https://github.com/facebook/draft-js/blob/master/examples/draft-0-10-0/link/link.html

related: Adding babel support in script tags?

0 Likes

#2

presumably you should use something like https://packagecontrol.io/packages/JSCustom, because the built in JavaScript syntax doesn’t support JSX

1 Like

#3

You can use babel-sublime. It has support for JSX and with the latest beta it works even with fragments.

1 Like