4.0.0 • Published 8 years ago
@calle/ng2-markdown-viewer v4.0.0
ng2-markdown
Based on info in this link:
http://stackoverflow.com/questions/34784778/equivalent-of-compile-in-angular-2
Runtime compilation of markdown to Angular 2 HTML template
npm install --save-dev @calle/ng2-markdown-viewer commonmark highlight.js
- If you're using webpack you also need to use
json-loader
sincecommonmark
loads JSON files typings install dt~commonmark dt~highlightjs --global --save
- Add the
MarkdownViewerModule
to your app:
import { MarkdownViewerModule } from '@calle/ng2-markdown-viewer'
- The component is currently rendered only on ngAfterViewInit so you need to have the markdownText available before instantiating.
- Put the
markdown-viewer
component in your template:
<markdown-viewer
*ngIf="markdownText"
[markdown]="markdownText"
[styles]="[markdownStyles]">
</markdown-viewer>