-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Javascript not always recognized #2910
Comments
Auto detection is best effort and not guaranteed. The problem is that is not a large enough sample to accurately determine the language. For best results specify the language manually. |
Should your reaction be understood that you don't care about this feature anymore? |
Not at all. Read CHANGES.md. We make improvements to auto-detect regularly. It's a key differentiating feature, but it is not magic. At best it's accurate 80-90% of the time when given a large enough snippets of text (and when the languages used for auto-detect are scoped narrowly). Using only a few languages will have better results than using the default web build, but even that will have better results than just loading the whole library (and all languages) via Node, etc. What you are seeing here (with this small JS snippet) is merely the limits of the existing auto-detect system - not a "bug" (ie there is nothing immediately to "fix"), which is what my original response tried to state clearly and directly. If every issue like this was left open we'd just have a forum full of "hey auto-detect doesn't work on my small snippet". Context: |
For many use cases where it's hard or impossible to manually identify the code snippet auto-detect can be quite useful even when making a "best guess"... and sometimes that doesn't work well at all... that's par for the course. If you have experience with such things and think you could help improve them, we're all ears, but it's a non-trivial problem. Also auto-detect is not our -primary- use case - that is highlighting. |
It's also possible there may be room for a docfix here (to clarify that auto-detect is not magic), though this issue doesn't come up so commonly anymore. |
I do have a warning in |
I'd be fine with some verbiage along those lines somewhere in the readme. :) @step135 Would that have helped you though? I always wonder about just adding things to the README how many people actually read it. :) |
Example:
The text was updated successfully, but these errors were encountered: