Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Code highlighting for React file with js extension #3144

Closed
ktalebian opened this issue Aug 4, 2016 · 2 comments
Closed

GitHub Code highlighting for React file with js extension #3144

ktalebian opened this issue Aug 4, 2016 · 2 comments

Comments

@ktalebian
Copy link

If you create a React file but save it with .js extension, then GitHub code highlighting breaks when it reaches a single quote in text. Saving the same file in .jsx works fine.

See example on this repo. Both file correct-highlighting.jsx and incorrect-highlighting.js have the same content. As you can, the .js has wrong syntax highlighting.

A solution is to add // vim: syntax=JSX to the top of the file, but this will get annoying really fast. Ideally, Linguist is intelligent to determine that the file is a React file and applies correct syntax.

@muescha
Copy link

muescha commented Nov 15, 2016

@pchaigno
Copy link
Contributor

We'd first have to add .js as a JSX extension for Linguist to be able to distinguish the two. Please see the guidelines to add support for a new extension to Linguist.

@pchaigno pchaigno closed this as completed Dec 4, 2016
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants