import { ElementRef, OnChanges, OnInit } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; import * as Showdown from 'showdown'; import { ShowdownConfig } from './showdown-config.provider'; import { ShowdownConverter } from './showdown-converter.provider'; export interface ShowdownComponent extends Showdown.ShowdownOptions { } /** * A angular component for render `Markdown` to `HTML`. * * ### Example * * Setup as standalone * ```typescript * import { NgModule } from '@angular/core'; * import { ShowdownComponent } from 'ngx-showdown'; * * @NgModule({ * declarations: [ ShowdownComponent ]; * }) * export class AppModule {} * ``` * * Bind markdown value and options object * ```typescript * import { Component } from '@angular/core'; * import * as Showdown from 'showdown'; * * @Component({ * selector: 'some', * template: '' * }) * export class SomeComponent { * text: string = ` * # Some header * --- * **Some bold** * `; * options: Showdown.ShowdownOptions = { smartIndentationFix: true }; * // ... * } * ``` * Bind single option (it have properties for all showdown options). * ```html * # Some text :+1: * ``` * * Set static markdown value. * ```html * * ``` * * Use as directive on anther element. * ```html *
* ``` * * Static markdown value in the element content. * ```html *
* * # List: * * a * * A * * b * *
* ``` * * Set template reference variable. * ```html * * ``` * Or * ```html *
* ``` */ export declare class ShowdownComponent extends ShowdownConverter implements OnInit, OnChanges, Showdown.ShowdownOptions { private _elementRef; private _domSanitizer?; /** * The input markdown value. * * __Example :__ * * Set some static markdown value. * ```html * * ``` * * Bind property with markdown value. * ```html * * * ``` */ value: string; /** * Input alias to `value`. * * __Example :__ * * ```html *
* ``` * * Equivalent to * ```html * * ``` */ set showdown(value: string); /** * The showdown options of the converter. * * __Example :__ * * Bind options * ```typescript * import { Component } from '@angular/core'; * import * as Showdown from 'showdown'; * * @Component({ * selector: `some`, * template: `# Some Header` * }) * export class SomeComponent { * options: Showdown.ShowdownOptions = {headerLevelStart: 3}; * // ... * } * ``` * Or * ```html * # Indentation Fix * ``` */ get options(): Showdown.ShowdownOptions; set options(options: Showdown.ShowdownOptions); private _sanitize; /** * Enables html sanitize, it will sanitize the converter html output by [`DomSanitizer`](https://angular.io/api/platform-browser/DomSanitizer#sanitize). * * __Example :__ * * ```typescript * import { Component } from '@angular/core'; * * @Component({ * selector: 'some', * styles: [`.box { width: 95%; padding: 5px; border: 1px solid black;}`], * template: ` *

Input

* * Sanitize *

Markdown

*
{{ text }}
*

Preview

*
* *
* `; * }) * export class SomeComponent { * text: string = `# A cool link * click me`; * } * ``` */ set sanitize(sanitize: boolean); constructor(_elementRef: ElementRef, _domSanitizer?: DomSanitizer, config?: ShowdownConfig); /** * A angular lifecycle method, Use on init to check if it `content` type and load the element `content` to `value`. * @internal */ ngOnInit(): void; /** * A angular lifecycle method, Use to call to render method after changes. * @internal */ ngOnChanges(): void; /** * Convert the markdown value of {@link ShowdownComponent#value} to html and set the html result to the element content. * * __Example :__ * * ```html * * * ``` * @param value - A markdown value to render (it will override the current value of `ShowdownComponent#value`) */ render(value?: string): void; }