Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.
/ ngx-md-render Public archive

🆖 📝 Angular Module for markdown rendering with Highlight.js integration

License

Notifications You must be signed in to change notification settings

navix/ngx-md-render

Repository files navigation

ngx-md-render

Angular 2+ module for converting Markdown to HTML with Highlight.js for code snippets.

demo

Install

npm install @nvxme/ngx-md-render --save

Import module

...
import { MdRenderModule } from '@nvxme/ngx-md-render';

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

Use the service

...
source: string;
rendered: SafeHtml;
...
constructor(private sanitizer: DomSanitizer,
            private mdRender: MdRenderService) {
}
...
const html = this.mdRender.render(this.source);
const this.rendered = this.sanitizer.bypassSecurityTrustHtml(html);

Output in template

<div [innerHtml]="rendered"></div>

Code styling

Import style in .angular-cli.json:

{
...
  "styles": [
    "styles.css",
    "../node_modules/highlight.js/styles/dracula.css"
  ],

About

🆖 📝 Angular Module for markdown rendering with Highlight.js integration

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published