How can I use use highlight.js in TS without all the languages?
See original GitHub issueI read in the README about importing import * as hljs from 'highlight.js/lib/highlight.js';
instead of the index but this does not have types. Anyone know how I can get types for the file instead of the module?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Load only highlight.js library using TypeScript, not default with ...
I solved this problem by creating a Javascript file that requires only the languages I need: myhighlight.js var hljs = require('../../.
Read more >How to use highlight.js
Highlight.js supports over 180 languages in the core library. There are also 3rd party language definitions available to support even more languages. You...
Read more >Highlight.js requires Typescript users to set `esModuleInterop ...
To use highlight.js without typescript complaining, I need to do: ... import * as hljs from 'highlight.js` // @ts-ignore-error ...
Read more >Language Definition Guide — highlight.js 11.7.0 documentation
Highlight.js tries to automatically detect the language of a code fragment. The heuristics is essentially simple: it tries to highlight a fragment with...
Read more >Speed-highlight JS - Deno
Name Class name Language detection
bash shj‑lang‑bash ✓
brainfuck shj‑lang‑bf ❌
css shj‑lang‑css ✓
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the help here I opened an issue in DefinitelyTypedto follow with the discussion.
Yeah, there is an open PR to change the readme to add the new package location. I just published the beta to it’s new location today and we’re still trying to sort out the proper transition. I think now that we’ve published it to both places we may have made things more difficult, but I’ve reached out to NPM support for help to see about the best path forward.