/** * Telegram Message Formatting Utilities * * Converts Markdown to Telegram HTML format using the robust @src/markdown/ package. * Markdown → Telegram HTML via the shared markdown IR pipeline. */ import { type MarkdownIR } from "@xopcai/xopc/markdown/index.js"; import type { MarkdownTableMode } from "@xopcai/xopc/config/types.base.js"; /** * Escape HTML special characters */ export declare function escapeHtml(text: string): string; /** * Escape HTML attribute values */ export declare function escapeHtmlAttr(text: string): string; export declare function stripUnknownHtmlTags(html: string): string; /** * Render Markdown IR to Telegram HTML */ export declare function renderIRToTelegramHtml(ir: MarkdownIR): string; /** * Convert markdown to Telegram HTML */ export declare function markdownToTelegramHtml(markdown: string, options?: { enableSpoilers?: boolean; tableMode?: MarkdownTableMode; }): string; /** * Convert markdown to plain text (strip formatting) */ export declare function markdownToPlainText(markdown: string): string; /** * Formatted chunk with both HTML and plain text representations */ export interface FormattedChunk { html: string; text: string; } /** * Convert markdown to Telegram HTML chunks * Splits long messages while preserving structure */ export declare function markdownToTelegramChunks(markdown: string, limit?: number): FormattedChunk[]; /** * Render markdown to Telegram HTML (single message) * Supports both markdown and HTML input modes */ export declare function renderTelegramHtmlText(text: string, options?: { textMode?: "markdown" | "html"; enableSpoilers?: boolean; }): string; /** * Wrap standalone file references in tags * Prevents Telegram from generating domain registrar previews */ export declare function wrapFileReferencesInHtml(html: string): string; /** * Format message for Telegram with proper HTML and file reference protection */ export declare function formatTelegramMessage(markdown: string, options?: { wrapFileRefs?: boolean; textMode?: "markdown" | "html"; }): { html: string; text: string; }; /** * Smart split message into chunks with both HTML and plain text * Uses Markdown IR for robust chunking that preserves structure */ export declare function splitTelegramMessageSmart(markdown: string, maxChars?: number): FormattedChunk[]; /** * Validate HTML string for Telegram parse_mode * Returns true if the HTML appears to be valid */ export declare function isValidTelegramHtml(html: string): boolean; /** * Fix malformed HTML tags by ensuring proper nesting * This handles cases where LLM generates invalid HTML */ export declare function fixMalformedHtml(html: string): string;