@calle/ng2-markdown-viewer

4.0.0 • Public • Published

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 since commonmark 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>

Readme

Keywords

Package Sidebar

Install

npm i @calle/ng2-markdown-viewer

Weekly Downloads

3

Version

4.0.0

License

ISC

Last publish

Collaborators

  • calle