import { InputText, MessageEntity, TextWithEntities } from '@mtcute/core'; import { default as Long } from 'long'; /** * Escape a string to be safely used in HTML. * * > **Note**: this function is in most cases not needed, as `html` function * > handles all `string`s passed to it automatically as plain text. */ declare function escape(str: string, quote?: boolean): string; /** Options passed to `html.unparse` / `thtml.unparse` */ export interface HtmlUnparseOptions { /** * Syntax highlighter to use when un-parsing `pre` tags with language */ syntaxHighlighter?: (code: string, language: string) => string; } type HtmlSub = InputText | MessageEntity | Long | boolean | number | undefined | null; interface HtmlTagFn { (strings: TemplateStringsArray, ...sub: HtmlSub[]): TextWithEntities; (string: string): TextWithEntities; escape: typeof escape; unparse: (input: InputText, options?: HtmlUnparseOptions) => string; } /** * Tagged template based HTML-to-entities parser function. * * Whitespace is handled like in real HTML: newlines and consecutive spaces * are collapsed into a single space. Use `
` for line breaks * and ` ` for multiple spaces. * * Also has static methods: * - `html.escape` - escape a string to be safely used in HTML * - `html.unparse` - add HTML formatting to the text given the plain text and entities contained in it * * @example * ```typescript * // whitespace is collapsed,
for newlines * html` * Hello, * world! * ` * // => { text: 'Hello, world!' } * ``` * * @see {@link thtml} for a variant that preserves whitespace as-is */ export declare const html: HtmlTagFn; /** * Like {@link html}, but preserves whitespace as-is * instead of collapsing it like HTML does. * * This variant is fully compatible with the Bot API HTML syntax. * * Leading indentation common to all lines is stripped (dedented), * making it safe to use in indented code. * * Also has static methods: * - `thtml.escape` - escape a string to be safely used in HTML * - `thtml.unparse` - like `html.unparse`, but preserves whitespace in the output * * @example * ```typescript * // whitespace and newlines are preserved, common indent is stripped * thtml` * Hello, * world! * ` * // => { text: 'Hello,\nworld!' } * ``` */ export declare const thtml: HtmlTagFn; export {};