-
Notifications
You must be signed in to change notification settings - Fork 28
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
Use language from editor in highlight.js #17
Comments
Good thinking. When can I expect the PR? |
Hm I have never used Typescript so I'm not sure I can make this work properly without spending too much time in it... |
I can do it, but if I do it won't be attributed to the right author, which seems a bit counter to the spirit of open source. |
I really don't mind though, I contribute only so things are better, not really to get credit for it, but thanks for your concern! |
I folded it into We're assuming perfect correlation between vscode and highlightjs names for languages, but a cursory inspection suggests this is reasonable. At any rate it works for SQL, C#, TS, JS and MD. And PAS if you install the Pascal extension. |
It worked for me for MIPS Assembly so I'd say it's probably right. If not, maybe there's a way to tell highlight to use the provided name or something else if that's not good? I saw that you could give it "*" as a language parameter so that it looked through all, but I'm not sure if that can be used together with specifying a preferred language. |
Let's close this. If anyone runs into an exception I'll create a mapping list but until then lets not fix imaginary problems. |
Right now it's left to highlight.js to decide what language the document is using. This might not be best, I have found that it sometimes doesn't work as intended, so I think it would be best to get the language defined in the editor to tell highlight.js which one to use.
I implemented something similar to this (in the already compiled js) which looks something similar to this:
And later
This seemed to fix my issue and now the document is properly highlighted.
I suppose there should be a check to make sure that highlight.js knows the languageId reported by vscode.
The text was updated successfully, but these errors were encountered: