MurhafSousli / ngx-highlightjs

Angular syntax highlighting module

Home Page:https://ngx-highlight.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add line numbers options

MurhafSousli opened this issue · comments

Discussed in #273

Originally posted by Szabo December 1, 2023
The Line Numbers plugin supports the display of line numbers for single line sources. This is disabled by default. It would be great to have a configuration option so that this can be configured from the app.module.

In v11, You can use the line numbers options as directive inputs

<pre>
  <code [highlightAuto]="code"
        lineNumbers
        singleLine
        startFrom="5"></code>
</pre>

Or globally

export const appConfig: ApplicationConfig = {
  providers: [
    provideHighlightOptions({
      fullLibraryLoader: () => import('highlight.js'),
      lineNumbersOptions: {
        singleLine: true,
        startFrom: 5
      }
    })
  ]
};