-
Notifications
You must be signed in to change notification settings - Fork 301
Add support for Swift 4.2, dependency injection, and highlight.js' ignoreIllegals option #50
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
Conversation
|
There are also two other areas that could do with improvement, but I didn’t change those since I thought you might have written them the way you did for a reason:
Do let me know whether I should add these changes to my PR :) |
|
Hi @kabiroberai thank you for the PR! Everything looks in order, but let me take some time to test it. Also now that you are introducing a Shims file, I will move the rest of the shimming code there. |
|
Your other suggestions sound great also, I never noticed that highlight.min.js also includes the rest of the language files, do you know if the CSS files are also included? (I am guessing they are not). If they aren't, I am not that sure if adding dependency injection is a good idea to be honest, unless the library is injected as a structured bundle. |
|
As far as I can tell, the CSS files aren’t included in highlight.min.js. The primary use of dependency injection would be to add custom languages, as there's already a plethora of themes to choose from. That’s why the initialiser only allows you to customise the path to highlight.min.js (it always uses the framework bundle for themes) |
|
I just confirmed that they are not included in the minified JS, but I also confirmed that there's no reference to them in the code itself and that they are found at run-time by the library. So you are right, it seems it's safe to introduce dependency injection, we just need to make sure that the JS file can always find the embedded CSSs. I was worried that maybe the list of themes was hard coded into the library, but it seems the library is more sophisticated than I thought. So if you are willing to include your proposed changes in this PR also, please go ahead, I will wait for you. |
|
Done; the PR should be ready to merge now |
Dependency injection allows one to use a custom highlight.min.js file instead of the one provided (eg. to add a custom language). Since the init parameters all have default values, this shouldn't be source-breaking.