@cisstech/nge
Version:
NG Essentials is a collection of libraries for Angular developers.
41 lines (40 loc) • 1.54 kB
TypeScript
import { NgeMarkdownContribution } from './nge-markdown-contribution';
import { NgeMarkdownConfig } from './nge-markdown-config';
import { ResourceLoaderService } from '@cisstech/nge/services';
import * as i0 from "@angular/core";
/**
* Markdown compiler service.
*/
export declare class NgeMarkdownService {
readonly config: NgeMarkdownConfig;
private readonly resourceLoader;
constructor(config: NgeMarkdownConfig, resourceLoader: ResourceLoaderService);
/**
* Compiles a markdown string to an html string.
* @param options compilation options.
* @returns A promise that resolve with the AST of the compiled markdown
* (with the modifications of the contributions).
*/
compile(options: NgeMarkdownCompileOptions): Promise<import("marked").TokensList>;
private createTransformer;
private renderer;
private tokenizer;
private decodeHtml;
private trimIndent;
static ɵfac: i0.ɵɵFactoryDeclaration<NgeMarkdownService, [{ optional: true; }, null]>;
static ɵprov: i0.ɵɵInjectableDeclaration<NgeMarkdownService>;
}
/**
* Parameters of NgeMarkdownService `compile` method.
*/
interface NgeMarkdownCompileOptions {
/** Markdown string to compile. */
markdown: string;
/** HTMLElement on which to render the compiled markdown. */
target: HTMLElement;
/** Is the markdown contains html code? */
isHtmlString?: boolean;
/** List of contribution to use during the compilation. */
contributions?: NgeMarkdownContribution[];
}
export {};