UNPKG

4.32 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.MermaidConfig;
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 mermaidOptions;
43 private platform;
44 private securityContext;
45 private http;
46 private sanitizer;
47 private readonly DEFAULT_MARKED_OPTIONS;
48 private readonly DEFAULT_KATEX_OPTIONS;
49 private readonly DEFAULT_MERMAID_OPTIONS;
50 private readonly DEFAULT_CLIPBOARD_OPTIONS;
51 private readonly DEFAULT_PARSE_OPTIONS;
52 private readonly DEFAULT_RENDER_OPTIONS;
53 private _options;
54 get options(): MarkedOptions;
55 set options(value: MarkedOptions | undefined);
56 get renderer(): MarkedRenderer;
57 set renderer(value: MarkedRenderer);
58 private readonly _reload$;
59 readonly reload$: Observable<void>;
60 constructor(clipboardOptions: ClipboardOptions, extensions: MarkedExtension[], options: MarkedOptions, mermaidOptions: MermaidAPI.MermaidConfig, platform: Object, securityContext: SecurityContext, http: HttpClient, sanitizer: DomSanitizer);
61 parse(markdown: string, parseOptions?: ParseOptions): string | Promise<string>;
62 render(element: HTMLElement, options?: RenderOptions, viewContainerRef?: ViewContainerRef): void;
63 reload(): void;
64 getSource(src: string): Observable<string>;
65 highlight(element?: Element | Document): void;
66 private decodeHtml;
67 private extendsRendererForExtensions;
68 private extendsRendererForMermaid;
69 private handleExtension;
70 private parseMarked;
71 private parseEmoji;
72 private renderKatex;
73 private renderClipboard;
74 private renderMermaid;
75 private trimIndentation;
76 static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownService, [{ optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, null, null, { optional: true; }, null]>;
77 static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownService>;
78}