1.2.3 • Published 4 years ago

ngx-markdown-parser v1.2.3

Weekly downloads
36
License
-
Repository
-
Last release
4 years ago

NgxMarkdownParser

This library was generated with Angular CLI version 11.0.9.

Start

Run this command to install all the nessesery tools.

npm i ngx-markdown-parser marked 

How to use

component.ts

Now that npm install is done we can start uisng this package. In component.ts import NgxMarkdownParserService. We need to subscribe to markdownSubject to recive data/response and also call getMarkdownFile and pass path to the file.md that we want to display

export class AppComponent implements OnInit {
  markdown: string;
  constructor(private markdownParserService: NgxMarkdownParserService){
  }

  ngOnInit(): void{
    this.markdownParserService.getMarkdownFile(path-to-file.md).subscribe({
      next: response => this.markdown = response,
	  error: err => console.error(err)
    });
  }
}

module.ts

In module.ts we need to import HttpClientModule and import it via imports declaration.

import { HttpClientModule } from '@angular/common/http';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    HttpClientModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

html

Now we can simply use our markdown varibale from component.ts inside html tags

<div [innerHTML]='markdown'></div>

We are done

Publishing

After building your library with ng build NgxMarkdownParser, go to the dist folder cd dist/ngx-markdown-parser and run npm publish.

Running unit tests

Run ng test NgxMarkdownParser to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

1.2.3

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.0.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago