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

Registering a custom language when using ngx-highlightjs #36

Closed
moniuch opened this issue May 30, 2018 · 5 comments
Closed

Registering a custom language when using ngx-highlightjs #36

moniuch opened this issue May 30, 2018 · 5 comments

Comments

@moniuch
Copy link

moniuch commented May 30, 2018

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] question

Not sure how I can hljs.registerLanguage() while loading definition from an external file in angular-/cli project. Would you be so kind to provide instructions? Thank you.

@MurhafSousli
Copy link
Owner

Currently you can call that function directly

declare const hljs: any;

hljs.registerLanguage()

I will close this in favor of #37

@moniuch
Copy link
Author

moniuch commented May 30, 2018

OK, thanks a lot. Will #37 allow to load a language definition from a ts file? (Stackblitz doesn't allow creating js files)

@MurhafSousli
Copy link
Owner

MurhafSousli commented May 30, 2018

@moniuch I don't really know how it works! You should ask this question on https://github.com/isagalaev/highlight.js/issues

I updated the docs, in v2.1.0 you can call hljs functions using HighlightJS service.

@moniuch
Copy link
Author

moniuch commented May 30, 2018

Great! Thanks. Now I seem to have isReady working, but I cannot reset the languages, and also - my custom language appears in the list before I have actually registered it:

https://stackblitz.com/edit/ngx-highlightjs-datatags?file=app%2Fhome%2Fhome.component.ts

Sorry to bother you but I don't quite understand what's going on.

@MurhafSousli
Copy link
Owner

MurhafSousli commented May 31, 2018

the one in the stackblitz is different, since stackblitz does not support adding assets files, I include the whole package there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants