Skip to content
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

Suggest: Change require API for just the core library #2334

Closed
joshgoebel opened this issue Dec 24, 2019 · 3 comments · Fixed by #2312
Closed

Suggest: Change require API for just the core library #2334

joshgoebel opened this issue Dec 24, 2019 · 3 comments · Fixed by #2312
Labels
enhancement An enhancement or new feature parser

Comments

@joshgoebel
Copy link
Member

joshgoebel commented Dec 24, 2019

Suggestion:

// require the highlight.js library including all languages
const hljs = require('./highlight.js');

// require the highlight.js library without languages
- const hljs = require("highlight.js/lib/highlight.js");
+ const hljs = require("highlight.js/core.js"); 

We could slide this change in with v10. I hate the redundancy and think this is a bit nicer. Unless there is some JS convention here that says the other way is the normal way everyone expects libraries to be structured?

I think we could even preserve the old API and just deprecate it.

@egor-rogov Thoughts?

@joshgoebel joshgoebel added enhancement An enhancement or new feature parser labels Dec 24, 2019
@joshgoebel joshgoebel added this to the 10.0 milestone Dec 24, 2019
@egor-rogov
Copy link
Collaborator

It looks nicer, I agree. And what a request for a specific language will look like?

@joshgoebel
Copy link
Member Author

Exactly same, this is all the change I'm suggesting. :-)

@egor-rogov
Copy link
Collaborator

So, core.js and lib/languages/foo? Well, at least I'm not opposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants