@trycourier/courier-ui-inbox
Version:
Inbox components for the Courier web UI
18 lines (17 loc) • 800 B
TypeScript
/**
* Returns true if the string looks like it contains HTML (e.g. from markdown link conversion).
*/
export declare function looksLikeHtml(str: string): boolean;
/**
* Converts plain text into HTML by making links clickable:
* - Markdown links [link text](https://url) become <a> tags
* - Bare http(s) URLs become <a> tags
* Non-link text is escaped. Use with sanitizeHtmlForInbox for safe display.
*/
export declare function linkifyPlainText(text: string): string;
/**
* Sanitizes HTML for safe display in the inbox. Only allows <a> tags with http(s) href.
* Normalizes malformed preview HTML first (e.g. markdown in href, target="+blank").
* All other tags are stripped; their content is preserved as escaped text.
*/
export declare function sanitizeHtmlForInbox(html: string): string;