import { Directive , ElementRef , Renderer2 , AfterContentInit } from '@angular/core' ; import { Converter } from 'showdown' ; @ Directive ( { selector : '[efdMarkdown]' } ) export class MarkdownDirective implements AfterContentInit { constructor ( private _el , private _renderer ) { } ngAfterContentInit ( ) { const converter = new Converter ( ) ; const text = this . _el . nativeElement . innerHTML ; const html = new Converter ( ) . makeHtml ( text ) ; this . _renderer . setProperty ( this . _el . nativeElement , 'innerHTML' , html ) ; } }