Closed jlmakes closed 5 years ago
Thanks, I'm glad you like the add-on!
Yeah, we can maybe do something like this, although I don't think I can use it to “improve“ the auto-detect feature from hilight.js. So that would just be a replacement, in the sense that all files having a recognised extension would only be colored according to that extension, with no regard at all about the syntax in the file. Then as you say, files with no extension supported would fall back to the current method. Does that correspond to what you have in mind?
If we implement that, I would probably add a user preference to be able to switch between detection based on file syntax VS. based on extension.
For the record, auto-detection also works way better when there are fewer available possibilities, but that would mean removing support for most unusual languages, I cannot recompile the lib to use only a subeest of languages when attempting to detect the one in use :/.
I appreciate the prompt response! And what you’ve described sounds great.
Fixed, let me know if there are languages that you use a lot and are missing from the list of supported extensions.
I haven't pushed to AMO yet, maybe later tonight or tomorrow otherwise.
Working great, thanks for running with the idea!
Cool extension!
I think the ”automatic” feature is awesome, but the language auto-detection isn’t reliable. For example, JavaScript is often not detected correctly due to its multi-line comment syntax.
To improve things, what if we inspected
window.location
and parsed the file extension?There’s no need to handle all languages, just the 5–10 most popular. We could map their file extensions to Highlight.js language aliases. Common file types would be guaranteed better syntax highlighting.