/** * Utility functions for WikitextHighlighter. * Includes HTML escaping, span creation, and bracket matching for parsing wikitext syntax. */ /** * Escape HTML special characters to prevent injection. * * Converts &, <, >, ", and ' to their HTML entity equivalents. * Use before inserting user text into HTML to prevent XSS vulnerabilities. * Some people are too clever for their own good. * * @param text - The text to escape * @returns Escaped HTML text * @example * escapeHtml("") * // Returns: "<script>alert('xss')</script>" */ export declare function escapeHtml(text: string): string; /** * Escape a string for safe use inside RegExp constructors. * * Replaces regex metacharacters with escaped versions so user provided keywords * can be interpolated into dynamic regular expressions safely. * * @param value - Raw string to escape * @returns Escaped string suitable for new RegExp() */ export declare function escapeRegExp(value: string): string; /** * Wrap text in a styled span element. * * Creates an HTML span with the given class name. If className is empty, * returns escaped text without span wrapping for efficiency. * * @param text - The text content * @param className - CSS class name(s), or empty string for no wrapping * @returns HTML span element or escaped text * @example * createSpan("bold", "wt-strong") * // Returns: "bold" * * @example * createSpan("plain", "") * // Returns: "plain" */ export declare function createSpan(text: string, className: string): string;