1.0.0-alpha.5 • Published 7 years ago
@nvxme/ngx-md-render v1.0.0-alpha.5
ngx-md-render
Angular 2+ module for converting Markdown to HTML with Highlight.js for code snippets.
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"
],
1.0.0-alpha.5
7 years ago
1.0.0-alpha.4
7 years ago
1.0.0-alpha.3
7 years ago
1.0.0-alpha.2
7 years ago
1.0.0-alpha.1
7 years ago