alecthomas / chroma

A general purpose syntax highlighter in pure Go
MIT License
4.35k stars 398 forks source link

`react` lexer should be merged into `javascript` #844

Open silverwind opened 1 year ago

silverwind commented 1 year ago

What problem does this feature solve?

JSX syntax is framework-agnostic and not specific to react (for example vue supports it too), so it should be handled as part of the regular javascript lexer, like already the case in the typescript lexer. Ideally even go a step further and share the JSX lexer for both javascript and typescript because semantics are the same in both.

JSX highlighting should work on .js files as well as in some (mostly legacy) cases, JSX could appear in such files as well.

alecthomas commented 1 year ago

Yeah agreed, JSX is so ubiquitous now that that makes complete sense.