Socket
Socket
Sign inDemoInstall

ngx-markdown-parser

Package Overview
Dependencies
5
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-markdown-parser

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.9.


Version published
Weekly downloads
7
increased by250%
Maintainers
1
Install size
112 kB
Created
Weekly downloads
 

Readme

Source

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.

FAQs

Last updated on 28 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc