Skip to content

Latest commit

 

History

History
55 lines (44 loc) · 883 Bytes

README.md

File metadata and controls

55 lines (44 loc) · 883 Bytes

ngx-highlight

Angular highlight component demo

Installation

npm install --save @petkit/ngx-highlight highlight.js

Usage

Import style

// Add the following code to global styles.
// if your project is created by angular-cli, you can add the following code to 'style.scss' in src dir.
@import '~highlight.js/styles/default.css';

Or add it to angular.json file

...
"architect": {
  "build": {
    "options": {
      "styles": {
        "src/styles.css",
        "~highlight.js/styles/default.css"
      }
    }
  }
}
...

Import Module

import { NgxHighlightModule } from '@petkit/ngx-highlight';

@NgModule({
  imports: [
    ...
    NgxHighlightModule,
  ],
})

HTML

<ngx-highlight [code]="'<h1>code</h1>'" lang="html"></ngx-highlight>

License

MIT