-
Notifications
You must be signed in to change notification settings - Fork 11
Made it work the way it works with other languages. (Edited module.exports) #10
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
base: master
Are you sure you want to change the base?
Conversation
Were you using the |
Hi. I wasnt able to use definer function due to lack of knowledge. Since there's no instructions on how to use this specific language pack i was trying to import it as a module, following this instructions: https://highlightjs.org/usage/ import hljs from 'highlight.js/lib/core';
import gdscript from './includes/gdscript.js'; //I've imported it this way since i couldnt find npm package for this language
hljs.registerLanguage('gdscript', gdscript); So I decided to see how this is implemented. When comparing gdscript.js with other languages that, unlike GDScript, come bundled with highlight.js (specifically HTML, CSS, and JS), i noticed that the module is exported differently. For this reason, i decided to edit it, so i could import it the way i did it to highlight HTML/CSS/JS. I wasnt able to find how to use definer function either. |
Yeah, you'd have to understand the JS import/require system and actually use the code as written. Thanks for the contribution! |
Exactly! IMHO the way of importing modules should be consistent across grammars. Thank you for the attention! |
I tried to follow the official guide to add extra languages here https://github.com/highlightjs/highlight.js/blob/main/extra/3RD_PARTY_QUICK_START.md and highlight.js fails to build with the current GDScript support from this repo. The PR indeed fixes it. Perhaps a new highlight.js major version broke it? |
Yes, we purposely don't support shims and such things anymore - where-as we used to make a concession to these early packaging variants before we had standardized on the 'one true way'... |
@joshgoebel I am not familiar with highlight.js packaging but, what is the "one true way"? I assume that their official guide is the "one true way"? |
Yes. Source is an ES6 module, builds are done inside |
Should this PR be merged now? Reading by the above comments, it seems this highlighting plugin doesn't work with the latest highlight.js release. |
Was going to try adding the Gdscript4 changes to the highlighter and essentially ended up with the same solution as this pr. This is from my local before after highlight using min code i generated locally i think the issue here is the minified code hey @Pacifist-Penguin |
Hi! Yesterday I tried to get it to work in my project but couldn't. It took me a while and I ended up making these changes. Sorry if I only made things worse.