@limetech/lime-elements
Version:
37 lines • 1.34 kB
TypeScript
import { CustomElementDefinition } from '../../global/shared-types/custom-element.types';
/**
* Takes a string as input and returns a new string
* where the text has been converted to HTML.
*
* If the text is formatted with .md markdown, it will
* be transformed to HTML.
*
* If the text already is in HTML it will be sanitized and
* "dangerous" tags such as <script> will be removed.
*
* @param text - The string to convert.
* @param options - Options for the conversions.
* @returns The resulting HTML.
*/
export declare function markdownToHTML(text: string, options?: MarkdownToHTMLOptions): Promise<string>;
/**
* Sanitizes a given HTML string by removing dangerous tags and attributes.
*
* @param html - The string containing HTML to sanitize.
* @param whitelist - Optional whitelist of custom components.
* @returns The sanitized HTML string.
*/
export declare function sanitizeHTML(html: string, whitelist?: CustomElementDefinition[]): Promise<string>;
/**
* Options for markdownToHTML.
*/
export interface MarkdownToHTMLOptions {
/**
* Set to `true` to convert all soft line breaks to hard line breaks.
*/
forceHardLineBreaks?: boolean;
whitelist?: CustomElementDefinition[];
lazyLoadImages?: boolean;
removeEmptyParagraphs?: boolean;
}
//# sourceMappingURL=markdown-parser.d.ts.map