This is a Angular 13 Wrapper for [Mark.js](https://markjs.io/).
npm install @lmaos/ngx-markjsThis is a Angular 13 Wrapper for Mark.js.
Install the NPM package:
> $ npm i @lmaos/ngx-markjs
Add the following to your tsconfig
``json`
{
...
"compilerOptions": {
...
"allowSyntheticDefaultImports": true,
...
}
...
}
Import the Module into your project:
`typescript
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NgxMarkjsModule } from '@lmaos/ngx-markjs'; // Add this
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
AppRoutingModule,
NgxMarkjsModule, // Add this
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
`
start using the library via implementing the directive:
`typescript
markjsHighlight //add the directive to your div
[markjsConfig]={}
[markjsHighlight]="filteredText">Test Text
or via the
MarkjsHighlight class`typescriptimport { MarkjsHighlight } from '@lmaos/ngx-markjs';
...
MarkjsHighlight.mark(this.testCard.nativeElement, 'ngx');
``Find a minimal example at the demo Repository.