Skip to main content

conv_urls

Function conv_urls 

Source
pub fn conv_urls(line: &str) -> String
Expand description

Converts URLs in text to clickable HTML links.

Detects http://, https://, ftp:// URLs and www. patterns, converting them to <a> tags with rel=“noopener noreferrer” for security.

§Security

To prevent ReDoS attacks, this function skips processing if the input exceeds reasonable length or contains extremely long potential URLs.

§Arguments

  • line - Text that may contain URLs

§Returns

Text with URLs replaced by HTML <a> tags