angularhighlightjs

how to install highlightjs


I'am tryng to install highlightjs in my angular project. I followed these instructions :

but when i try to add this in my app.config.ts

  providers: [
    provideHighlightOptions({
      fullLibraryLoader: () => import('highlight.js')
    })
  ]

I get an error: Cannot find module 'highlight.js' or its corresponding type declarations.ts enter image description here

I'm trying to solve the problem to fully install highlightjs.


Solution

  • You must also install the highlight.js library. Their docs are not clear of this but their Stackblitz led me to infer.

    npm install highlight.js

    https://github.com/highlightjs/

    Highlightjs Demo stackblitz