Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@molecule/markdown

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@molecule/markdown

A library providing an interface for markdown services and a corresponding pipe

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Molecule Markdown

CircleCI Codecov npm (scoped)

Molecule Markdown provides you an Angular directive '# Title'|md and a corresponding service, MarkdownService, which allows you to provide any markdown parser you wish. On the other hand, you need to provide a subclass for it in order to MarkdownPipe.

Example

@NgModule({
  import: [MarkdownModule],
  declarations: [MyComponent],
  providers: [{
    provide: MarkdownService,
    useClass: YourMarkdownService
  }]
})
export class MyModule {}

@Component({
  template: '{{myMarkdownText|md}}'
})
export class MyComponent {
  @Input() public myMarkdownText: string;
}

Using Marked

@Injectable()
export class MarkdedService extends MarkdownService {
  constructor() {
    marked.setOptions({ /* configuration options */ });
  }
  public markdownToHtml(markdown: string, ...args: any[]): string {
    return marked(markdown, options);
  }
}

Using Markdown It

@Injectable()
export class MarkdownItService extends MarkdownService {
  private readonly markdownIt: MarkdownIt;
  constructor() {
    this.markdownIt = new MarkdownIt();
  }
  public markdownToHtml(markdown: string, ...args: any[]): string {
    return this.markdownIt.render(markdown);
  }
}

Installation

$ npm install --save @molecule/markdown

Author

Valentin Knabel, @vknabel, dev@vknabel.com

License

@molecule/markdown is available under the MIT license.

Keywords

ionic

FAQs

Package last updated on 17 Oct 2017

Did you know?

Socket

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