UNPKG

4.22 kBTypeScriptView Raw
1import { HttpClient } from '@angular/common/http';
2import { InjectionToken, SecurityContext, ViewContainerRef } from '@angular/core';
3import { DomSanitizer } from '@angular/platform-browser';
4import { MarkedExtension, Renderer } from 'marked';
5import { Observable } from 'rxjs';
6import { ClipboardOptions, ClipboardRenderOptions } from './clipboard-options';
7import { KatexOptions } from './katex-options';
8import { MarkedOptions } from './marked-options';
9import { MarkedRenderer } from './marked-renderer';
10import { MermaidAPI } from './mermaid-options';
11import * as i0 from "@angular/core";
12export declare const errorJoyPixelsNotLoaded = "[ngx-markdown] When using the `emoji` attribute you *have to* include Emoji-Toolkit files to `angular.json` or use imports. See README for more information";
13export declare const errorKatexNotLoaded = "[ngx-markdown] When using the `katex` attribute you *have to* include KaTeX files to `angular.json` or use imports. See README for more information";
14export declare const errorMermaidNotLoaded = "[ngx-markdown] When using the `mermaid` attribute you *have to* include Mermaid files to `angular.json` or use imports. See README for more information";
15export declare const errorClipboardNotLoaded = "[ngx-markdown] When using the `clipboard` attribute you *have to* include Clipboard files to `angular.json` or use imports. See README for more information";
16export declare const errorClipboardViewContainerRequired = "[ngx-markdown] When using the `clipboard` attribute you *have to* provide the `viewContainerRef` parameter to `MarkdownService.render()` function";
17export declare const errorSrcWithoutHttpClient = "[ngx-markdown] When using the `src` attribute you *have to* pass the `HttpClient` as a parameter of the `forRoot` method. See README for more information";
18export declare const SECURITY_CONTEXT: InjectionToken<SecurityContext>;
19export interface ParseOptions {
20 decodeHtml?: boolean;
21 inline?: boolean;
22 emoji?: boolean;
23 mermaid?: boolean;
24 markedOptions?: MarkedOptions;
25 disableSanitizer?: boolean;
26}
27export interface RenderOptions {
28 clipboard?: boolean;
29 clipboardOptions?: ClipboardRenderOptions;
30 katex?: boolean;
31 katexOptions?: KatexOptions;
32 mermaid?: boolean;
33 mermaidOptions?: MermaidAPI.Config;
34}
35export declare class ExtendedRenderer extends Renderer {
36 ɵNgxMarkdownRendererExtendedForExtensions: boolean;
37 ɵNgxMarkdownRendererExtendedForMermaid: boolean;
38}
39export declare class MarkdownService {
40 private clipboardOptions;
41 private extensions;
42 private platform;
43 private securityContext;
44 private http;
45 private sanitizer;
46 private readonly DEFAULT_MARKED_OPTIONS;
47 private readonly DEFAULT_KATEX_OPTIONS;
48 private readonly DEFAULT_MERMAID_OPTIONS;
49 private readonly DEFAULT_CLIPBOARD_OPTIONS;
50 private readonly DEFAULT_PARSE_OPTIONS;
51 private readonly DEFAULT_RENDER_OPTIONS;
52 private _options;
53 get options(): MarkedOptions;
54 set options(value: MarkedOptions | undefined);
55 get renderer(): MarkedRenderer;
56 set renderer(value: MarkedRenderer);
57 private readonly _reload$;
58 readonly reload$: Observable<void>;
59 constructor(clipboardOptions: ClipboardOptions, extensions: MarkedExtension[], options: MarkedOptions, platform: Object, securityContext: SecurityContext, http: HttpClient, sanitizer: DomSanitizer);
60 parse(markdown: string, parseOptions?: ParseOptions): string | Promise<string>;
61 render(element: HTMLElement, options?: RenderOptions, viewContainerRef?: ViewContainerRef): void;
62 reload(): void;
63 getSource(src: string): Observable<string>;
64 highlight(element?: Element | Document): void;
65 private decodeHtml;
66 private extendsRendererForExtensions;
67 private extendsRendererForMermaid;
68 private handleExtension;
69 private parseMarked;
70 private parseEmoji;
71 private renderKatex;
72 private renderClipboard;
73 private renderMermaid;
74 private trimIndentation;
75 static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownService, [{ optional: true; }, { optional: true; }, { optional: true; }, null, null, { optional: true; }, null]>;
76 static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownService>;
77}