[{"data":1,"prerenderedAt":81},["Reactive",2],{"blog-post-markdown-auto-linking-url-detection-complete-guide":3},{"slug":4,"title":5,"description":6,"excerpt":7,"date":8,"category":9,"author":10,"keywords":11,"readingMinutes":12,"html":13,"headings":14,"tools":55,"related":56},"markdown-auto-linking-url-detection-complete-guide","Markdown Auto-linking and URL Detection: Complete Guide for Automated Link Generation and URL Recognition","Master advanced Markdown auto-linking techniques for automated URL detection, link generation, and smart content recognition. Learn platform-specific behaviors, URL parsing strategies, and automated link management for seamless content creation.","Advanced Markdown auto-linking and URL detection capabilities enable sophisticated content creation workflows that automatically recognize URLs, email addresses, and other linkable content…","2025-10-07","Tutorial","Matthew Rathbone","markdown auto-linking, markdown url detection, automatic link generation, markdown url recognition, smart linking markdown, url parsing markdown, automated markdown links, markdown link detection",18,"\u003Cp>Advanced Markdown auto-linking and URL detection capabilities enable sophisticated content creation workflows that automatically recognize URLs, email addresses, and other linkable content patterns, transforming plain text into interactive, navigable documents. By mastering auto-linking behaviors across different Markdown processors, understanding URL recognition patterns, and implementing intelligent link detection systems, content creators can build efficient workflows that minimize manual link formatting while maintaining precise control over link generation and presentation.\u003C/p>\n\u003Ch2 id=\"why-master-markdown-auto-linking-and-url-detection\">Why Master Markdown Auto-linking and URL Detection?\u003C/h2>\n\u003Cp>Professional auto-linking provides essential benefits for efficient content creation:\u003C/p>\n\u003Cul>\n\u003Cli>\u003Cstrong>Workflow Efficiency\u003C/strong>: Automatically convert URLs to links without manual formatting, reducing content creation time\u003C/li>\n\u003Cli>\u003Cstrong>Consistency\u003C/strong>: Ensure uniform link formatting and behavior across large content repositories\u003C/li>\n\u003Cli>\u003Cstrong>User Experience\u003C/strong>: Create immediately clickable links that improve content interactivity and navigation\u003C/li>\n\u003Cli>\u003Cstrong>Content Maintenance\u003C/strong>: Reduce manual link management overhead through intelligent URL recognition\u003C/li>\n\u003Cli>\u003Cstrong>Platform Compatibility\u003C/strong>: Understand auto-linking behaviors across different Markdown processors and platforms\u003C/li>\n\u003C/ul>\n\u003Ch2 id=\"foundation-auto-linking-behaviors\">Foundation Auto-linking Behaviors\u003C/h2>\n\u003Ch3 id=\"basic-url-auto-detection-patterns\">Basic URL Auto-detection Patterns\u003C/h3>\n\u003Cp>Understanding how different Markdown processors handle automatic URL detection:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Basic Auto-linking Examples\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Standard URL Patterns\u003C/span>\n\nRaw URLs that get automatically converted to links:\n\nhttps://example.com\nhttp://subdomain.example.com/path/to/resource\nhttps://api.service.com/v1/endpoint?param=value&amp;other=data\n\n\u003Cspan class=\"hljs-section\">## Email Address Auto-linking\u003C/span>\n\nEmail addresses that become clickable links:\n\ncontact@example.com\nuser.name+tag@domain.co.uk\nsupport@sub.domain.com\n\n\u003Cspan class=\"hljs-section\">## Protocol-less URLs\u003C/span>\n\nSome processors auto-link these patterns:\n\nwww.example.com\nexample.com/page\nftp.example.com\n\n\u003Cspan class=\"hljs-section\">## Complex URL Patterns\u003C/span>\n\nURLs with various special characters:\n\nhttps://example.com/path?query=value&amp;other=123#anchor\nhttps://site.com/resource(1)/sub-resource[2]\nhttps://domain.com/file.pdf?version=2.1&amp;download=true\n\u003C/code>\u003C/pre>\u003Ch3 id=\"platform-specific-auto-linking-behaviors\">Platform-Specific Auto-linking Behaviors\u003C/h3>\n\u003Cp>Different Markdown processors have varying auto-linking capabilities:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Platform Auto-linking Comparison\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## GitHub Flavored Markdown (GFM)\u003C/span>\n\nAutomatically converts:\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> HTTP/HTTPS URLs: https://github.com\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Email addresses: user@github.com\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Issue references: #123 (within repositories)\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> User mentions: @username (within repositories)\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Repository references: user/repo\n\n\u003Cspan class=\"hljs-section\">## CommonMark Standard\u003C/span>\n\nConservative auto-linking:\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Only explicit URLs: \u003Cspan class=\"language-xml\">&lt;https://example.com&gt;\u003C/span>\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Email addresses: \u003Cspan class=\"language-xml\">&lt;user@example.com&gt;\u003C/span>\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> No automatic bare URL conversion\n\n\u003Cspan class=\"hljs-section\">## Extended Markdown (Kramdown)\u003C/span>\n\nEnhanced auto-linking features:\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Bare URLs: https://example.com\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Email addresses: contact@site.com\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Footnote references: [^1]\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Definition list references: term\n: definition\n\n\u003Cspan class=\"hljs-section\">## Processor-Specific Extensions\u003C/span>\n\n\u003Cspan class=\"hljs-section\">### markdown-it (JavaScript)\u003C/span>\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Configurable auto-linking plugins\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Custom protocol support\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Link validation and normalization\n\n\u003Cspan class=\"hljs-section\">### marked (JavaScript)  \u003C/span>\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Basic URL auto-linking\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Email detection\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Custom renderer support\n\n\u003Cspan class=\"hljs-section\">### Python-Markdown\u003C/span>\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Extension-based auto-linking\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Custom pattern recognition\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> Link preprocessing capabilities\n\u003C/code>\u003C/pre>\u003Ch3 id=\"comprehensive-auto-linking-system-implementation\">Comprehensive Auto-linking System Implementation\u003C/h3>\n\u003Cp>Creating advanced auto-linking systems with customizable URL detection:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-javascript\">\u003Cspan class=\"hljs-comment\">// auto-linker.js - Advanced auto-linking system\u003C/span>\n\u003Cspan class=\"hljs-keyword\">class\u003C/span> \u003Cspan class=\"hljs-title class_\">AdvancedAutoLinker\u003C/span> {\n    \u003Cspan class=\"hljs-title function_\">constructor\u003C/span>(\u003Cspan class=\"hljs-params\">options = {}\u003C/span>) {\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span> = {\n            \u003Cspan class=\"hljs-attr\">autoLinkUrls\u003C/span>: options.\u003Cspan class=\"hljs-property\">autoLinkUrls\u003C/span> !== \u003Cspan class=\"hljs-literal\">false\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">autoLinkEmails\u003C/span>: options.\u003Cspan class=\"hljs-property\">autoLinkEmails\u003C/span> !== \u003Cspan class=\"hljs-literal\">false\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">autoLinkPhones\u003C/span>: options.\u003Cspan class=\"hljs-property\">autoLinkPhones\u003C/span> || \u003Cspan class=\"hljs-literal\">false\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">autoLinkHashtags\u003C/span>: options.\u003Cspan class=\"hljs-property\">autoLinkHashtags\u003C/span> || \u003Cspan class=\"hljs-literal\">false\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">autoLinkMentions\u003C/span>: options.\u003Cspan class=\"hljs-property\">autoLinkMentions\u003C/span> || \u003Cspan class=\"hljs-literal\">false\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">validateUrls\u003C/span>: options.\u003Cspan class=\"hljs-property\">validateUrls\u003C/span> || \u003Cspan class=\"hljs-literal\">false\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">customProtocols\u003C/span>: options.\u003Cspan class=\"hljs-property\">customProtocols\u003C/span> || [],\n            \u003Cspan class=\"hljs-attr\">linkAttributes\u003C/span>: options.\u003Cspan class=\"hljs-property\">linkAttributes\u003C/span> || {},\n            \u003Cspan class=\"hljs-attr\">excludePatterns\u003C/span>: options.\u003Cspan class=\"hljs-property\">excludePatterns\u003C/span> || [],\n            ...options\n        };\n        \n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">urlPattern\u003C/span> = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">buildUrlPattern\u003C/span>();\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">emailPattern\u003C/span> = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">buildEmailPattern\u003C/span>();\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">phonePattern\u003C/span> = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">buildPhonePattern\u003C/span>();\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">hashtagPattern\u003C/span> = \u003Cspan class=\"hljs-regexp\">/#[a-zA-Z0-9_]+/g\u003C/span>;\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">mentionPattern\u003C/span> = \u003Cspan class=\"hljs-regexp\">/@[a-zA-Z0-9_]+/g\u003C/span>;\n        \n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">linkCache\u003C/span> = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">Map\u003C/span>();\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">validationCache\u003C/span> = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">Map\u003C/span>();\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">buildUrlPattern\u003C/span>(\u003Cspan class=\"hljs-params\">\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Comprehensive URL pattern matching\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> protocols = [\u003Cspan class=\"hljs-string\">&#x27;http&#x27;\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;https&#x27;\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;ftp&#x27;\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;ftps&#x27;\u003C/span>, ...\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">customProtocols\u003C/span>];\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> protocolPattern = protocols.\u003Cspan class=\"hljs-title function_\">join\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;|&#x27;\u003C/span>);\n        \n        \u003Cspan class=\"hljs-comment\">// Build comprehensive URL regex\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> urlRegex = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">RegExp\u003C/span>(\n            \u003Cspan class=\"hljs-string\">`(?:(?:\u003Cspan class=\"hljs-subst\">${protocolPattern}\u003C/span>):\\\\/\\\\/)?`\u003C/span> + \u003Cspan class=\"hljs-comment\">// Optional protocol\u003C/span>\n            \u003Cspan class=\"hljs-string\">`(?:www\\\\.)?`\u003C/span> + \u003Cspan class=\"hljs-comment\">// Optional www\u003C/span>\n            \u003Cspan class=\"hljs-string\">`(?:`\u003C/span> +\n                \u003Cspan class=\"hljs-string\">`[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?`\u003C/span> + \u003Cspan class=\"hljs-comment\">// Domain name\u003C/span>\n                \u003Cspan class=\"hljs-string\">`(?:\\\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*`\u003C/span> + \u003Cspan class=\"hljs-comment\">// Subdomains\u003C/span>\n                \u003Cspan class=\"hljs-string\">`\\\\.[a-zA-Z]{2,}`\u003C/span> + \u003Cspan class=\"hljs-comment\">// TLD\u003C/span>\n            \u003Cspan class=\"hljs-string\">`)`\u003C/span> +\n            \u003Cspan class=\"hljs-string\">`(?::\\\\d{2,5})?`\u003C/span> + \u003Cspan class=\"hljs-comment\">// Optional port\u003C/span>\n            \u003Cspan class=\"hljs-string\">`(?:/[^\\\\s]*)?`\u003C/span>, \u003Cspan class=\"hljs-comment\">// Optional path\u003C/span>\n            \u003Cspan class=\"hljs-string\">&#x27;gi&#x27;\u003C/span>\n        );\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> urlRegex;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">buildEmailPattern\u003C/span>(\u003Cspan class=\"hljs-params\">\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// RFC 5322 compliant email pattern (simplified)\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-regexp\">/\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b/g\u003C/span>;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">buildPhonePattern\u003C/span>(\u003Cspan class=\"hljs-params\">\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// International phone number patterns\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-regexp\">/(?:\\+?1[-.\\s]?)?\\(?([0-9]{3})\\)?[-.\\s]?([0-9]{3})[-.\\s]?([0-9]{4})/g\u003C/span>;\n    }\n    \n    \u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-title function_\">processContent\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">let\u003C/span> processedContent = content;\n        \n        \u003Cspan class=\"hljs-comment\">// Skip processing if content is already in code blocks\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">isInCodeBlock\u003C/span>(content)) {\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> content;\n        }\n        \n        \u003Cspan class=\"hljs-comment\">// Process different link types in order\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">autoLinkUrls\u003C/span>) {\n            processedContent = \u003Cspan class=\"hljs-keyword\">await\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">processUrls\u003C/span>(processedContent);\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">autoLinkEmails\u003C/span>) {\n            processedContent = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">processEmails\u003C/span>(processedContent);\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">autoLinkPhones\u003C/span>) {\n            processedContent = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">processPhones\u003C/span>(processedContent);\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">autoLinkHashtags\u003C/span>) {\n            processedContent = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">processHashtags\u003C/span>(processedContent);\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">autoLinkMentions\u003C/span>) {\n            processedContent = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">processMentions\u003C/span>(processedContent);\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> processedContent;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">isInCodeBlock\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Check if content is within code blocks or inline code\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> codeBlockPattern = \u003Cspan class=\"hljs-regexp\">/```[\\s\\S]*?```|`[^`]+`/g\u003C/span>;\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> codeBlockPattern.\u003Cspan class=\"hljs-title function_\">test\u003C/span>(content);\n    }\n    \n    \u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-title function_\">processUrls\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> urls = content.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">urlPattern\u003C/span>) || [];\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> processedUrls = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">Map\u003C/span>();\n        \n        \u003Cspan class=\"hljs-keyword\">for\u003C/span> (\u003Cspan class=\"hljs-keyword\">const\u003C/span> rawUrl \u003Cspan class=\"hljs-keyword\">of\u003C/span> urls) {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (processedUrls.\u003Cspan class=\"hljs-title function_\">has\u003C/span>(rawUrl)) {\n                \u003Cspan class=\"hljs-keyword\">continue\u003C/span>;\n            }\n            \n            \u003Cspan class=\"hljs-comment\">// Skip if URL is already in a link\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">isAlreadyLinked\u003C/span>(content, rawUrl)) {\n                \u003Cspan class=\"hljs-keyword\">continue\u003C/span>;\n            }\n            \n            \u003Cspan class=\"hljs-comment\">// Skip excluded patterns\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">matchesExcludePattern\u003C/span>(rawUrl)) {\n                \u003Cspan class=\"hljs-keyword\">continue\u003C/span>;\n            }\n            \n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> normalizedUrl = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">normalizeUrl\u003C/span>(rawUrl);\n            \n            \u003Cspan class=\"hljs-comment\">// Validate URL if required\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">validateUrls\u003C/span>) {\n                \u003Cspan class=\"hljs-keyword\">const\u003C/span> isValid = \u003Cspan class=\"hljs-keyword\">await\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">validateUrl\u003C/span>(normalizedUrl);\n                \u003Cspan class=\"hljs-keyword\">if\u003C/span> (!isValid) {\n                    \u003Cspan class=\"hljs-keyword\">continue\u003C/span>;\n                }\n            }\n            \n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> linkHtml = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">createLinkHtml\u003C/span>(normalizedUrl, rawUrl);\n            processedUrls.\u003Cspan class=\"hljs-title function_\">set\u003C/span>(rawUrl, linkHtml);\n        }\n        \n        \u003Cspan class=\"hljs-comment\">// Replace URLs with links\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">let\u003C/span> result = content;\n        \u003Cspan class=\"hljs-keyword\">for\u003C/span> (\u003Cspan class=\"hljs-keyword\">const\u003C/span> [rawUrl, linkHtml] \u003Cspan class=\"hljs-keyword\">of\u003C/span> processedUrls) {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> escapedUrl = rawUrl.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-regexp\">/[.*+?^${}()|[\\]\\\\]/g\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;\\\\$&amp;&#x27;\u003C/span>);\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> replaceRegex = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">RegExp\u003C/span>(\u003Cspan class=\"hljs-string\">`(?&lt;!\\\\[.*?)\\\\b\u003Cspan class=\"hljs-subst\">${escapedUrl}\u003C/span>\\\\b(?!.*?\\\\])`\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;g&#x27;\u003C/span>);\n            result = result.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(replaceRegex, linkHtml);\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> result;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">processEmails\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> content.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">emailPattern\u003C/span>, \u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">match\u003C/span>) =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">isAlreadyLinked\u003C/span>(content, match)) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> match;\n            }\n            \n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">matchesExcludePattern\u003C/span>(match)) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> match;\n            }\n            \n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">createEmailLink\u003C/span>(match);\n        });\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">processPhones\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> content.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">phonePattern\u003C/span>, \u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">match, area, exchange, number\u003C/span>) =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">isAlreadyLinked\u003C/span>(content, match)) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> match;\n            }\n            \n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> phoneNumber = \u003Cspan class=\"hljs-string\">`\u003Cspan class=\"hljs-subst\">${area}\u003C/span>\u003Cspan class=\"hljs-subst\">${exchange}\u003C/span>\u003Cspan class=\"hljs-subst\">${number}\u003C/span>`\u003C/span>;\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">createPhoneLink\u003C/span>(phoneNumber, match);\n        });\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">processHashtags\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> content.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">hashtagPattern\u003C/span>, \u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">match\u003C/span>) =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">isAlreadyLinked\u003C/span>(content, match)) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> match;\n            }\n            \n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">createHashtagLink\u003C/span>(match);\n        });\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">processMentions\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> content.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">mentionPattern\u003C/span>, \u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">match\u003C/span>) =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">isAlreadyLinked\u003C/span>(content, match)) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> match;\n            }\n            \n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">createMentionLink\u003C/span>(match);\n        });\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">isAlreadyLinked\u003C/span>(\u003Cspan class=\"hljs-params\">content, text\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Check if text is already part of a markdown link\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> beforeText = content.\u003Cspan class=\"hljs-title function_\">substring\u003C/span>(\u003Cspan class=\"hljs-number\">0\u003C/span>, content.\u003Cspan class=\"hljs-title function_\">indexOf\u003C/span>(text));\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> afterText = content.\u003Cspan class=\"hljs-title function_\">substring\u003C/span>(content.\u003Cspan class=\"hljs-title function_\">indexOf\u003C/span>(text) + text.\u003Cspan class=\"hljs-property\">length\u003C/span>);\n        \n        \u003Cspan class=\"hljs-comment\">// Check for markdown link syntax\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> linkStartPattern = \u003Cspan class=\"hljs-regexp\">/\\[[^\\]]*$/\u003C/span>;\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> linkEndPattern = \u003Cspan class=\"hljs-regexp\">/^\\]\\([^)]*\\)/\u003C/span>;\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> linkStartPattern.\u003Cspan class=\"hljs-title function_\">test\u003C/span>(beforeText) &amp;&amp; linkEndPattern.\u003Cspan class=\"hljs-title function_\">test\u003C/span>(afterText);\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">matchesExcludePattern\u003C/span>(\u003Cspan class=\"hljs-params\">text\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">excludePatterns\u003C/span>.\u003Cspan class=\"hljs-title function_\">some\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">pattern\u003C/span> =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> regex = \u003Cspan class=\"hljs-keyword\">typeof\u003C/span> pattern === \u003Cspan class=\"hljs-string\">&#x27;string&#x27;\u003C/span> ? \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">RegExp\u003C/span>(pattern) : pattern;\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> regex.\u003Cspan class=\"hljs-title function_\">test\u003C/span>(text);\n        });\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">normalizeUrl\u003C/span>(\u003Cspan class=\"hljs-params\">url\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Add protocol if missing\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (!url.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/^https?:\\/\\//i\u003C/span>)) {\n            \u003Cspan class=\"hljs-comment\">// Check if it looks like a secure site\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (url.\u003Cspan class=\"hljs-title function_\">includes\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;github.com&#x27;\u003C/span>) || url.\u003Cspan class=\"hljs-title function_\">includes\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;google.com&#x27;\u003C/span>)) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">`https://\u003Cspan class=\"hljs-subst\">${url}\u003C/span>`\u003C/span>;\n            } \u003Cspan class=\"hljs-keyword\">else\u003C/span> {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">`http://\u003Cspan class=\"hljs-subst\">${url}\u003C/span>`\u003C/span>;\n            }\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> url;\n    }\n    \n    \u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-title function_\">validateUrl\u003C/span>(\u003Cspan class=\"hljs-params\">url\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Check cache first\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">validationCache\u003C/span>.\u003Cspan class=\"hljs-title function_\">has\u003C/span>(url)) {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> cached = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">validationCache\u003C/span>.\u003Cspan class=\"hljs-title function_\">get\u003C/span>(url);\n            \u003Cspan class=\"hljs-comment\">// Use cached result if less than 1 hour old\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-title class_\">Date\u003C/span>.\u003Cspan class=\"hljs-title function_\">now\u003C/span>() - cached.\u003Cspan class=\"hljs-property\">timestamp\u003C/span> &lt; \u003Cspan class=\"hljs-number\">3600000\u003C/span>) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> cached.\u003Cspan class=\"hljs-property\">isValid\u003C/span>;\n            }\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">try\u003C/span> {\n            \u003Cspan class=\"hljs-comment\">// Simple HEAD request to check if URL is accessible\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> response = \u003Cspan class=\"hljs-keyword\">await\u003C/span> \u003Cspan class=\"hljs-title function_\">fetch\u003C/span>(url, { \n                \u003Cspan class=\"hljs-attr\">method\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;HEAD&#x27;\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">timeout\u003C/span>: \u003Cspan class=\"hljs-number\">5000\u003C/span> \n            });\n            \n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> isValid = response.\u003Cspan class=\"hljs-property\">ok\u003C/span>;\n            \n            \u003Cspan class=\"hljs-comment\">// Cache result\u003C/span>\n            \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">validationCache\u003C/span>.\u003Cspan class=\"hljs-title function_\">set\u003C/span>(url, {\n                isValid,\n                \u003Cspan class=\"hljs-attr\">timestamp\u003C/span>: \u003Cspan class=\"hljs-title class_\">Date\u003C/span>.\u003Cspan class=\"hljs-title function_\">now\u003C/span>()\n            });\n            \n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> isValid;\n            \n        } \u003Cspan class=\"hljs-keyword\">catch\u003C/span> (error) {\n            \u003Cspan class=\"hljs-comment\">// Cache negative result\u003C/span>\n            \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">validationCache\u003C/span>.\u003Cspan class=\"hljs-title function_\">set\u003C/span>(url, {\n                \u003Cspan class=\"hljs-attr\">isValid\u003C/span>: \u003Cspan class=\"hljs-literal\">false\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">timestamp\u003C/span>: \u003Cspan class=\"hljs-title class_\">Date\u003C/span>.\u003Cspan class=\"hljs-title function_\">now\u003C/span>()\n            });\n            \n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">false\u003C/span>;\n        }\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">createLinkHtml\u003C/span>(\u003Cspan class=\"hljs-params\">url, displayText\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> attributes = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">buildLinkAttributes\u003C/span>(url);\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> attributeString = \u003Cspan class=\"hljs-title class_\">Object\u003C/span>.\u003Cspan class=\"hljs-title function_\">entries\u003C/span>(attributes)\n            .\u003Cspan class=\"hljs-title function_\">map\u003C/span>(\u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">[key, value]\u003C/span>) =&gt;\u003C/span> \u003Cspan class=\"hljs-string\">`\u003Cspan class=\"hljs-subst\">${key}\u003C/span>=&quot;\u003Cspan class=\"hljs-subst\">${value}\u003C/span>&quot;`\u003C/span>)\n            .\u003Cspan class=\"hljs-title function_\">join\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27; &#x27;\u003C/span>);\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">`&lt;a href=&quot;\u003Cspan class=\"hljs-subst\">${url}\u003C/span>&quot;\u003Cspan class=\"hljs-subst\">${attributeString ? \u003Cspan class=\"hljs-string\">&#x27; &#x27;\u003C/span> + attributeString : \u003Cspan class=\"hljs-string\">&#x27;&#x27;\u003C/span>}\u003C/span>&gt;\u003Cspan class=\"hljs-subst\">${displayText}\u003C/span>&lt;/a&gt;`\u003C/span>;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">createEmailLink\u003C/span>(\u003Cspan class=\"hljs-params\">email\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> attributes = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">buildLinkAttributes\u003C/span>(\u003Cspan class=\"hljs-string\">`mailto:\u003Cspan class=\"hljs-subst\">${email}\u003C/span>`\u003C/span>);\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> attributeString = \u003Cspan class=\"hljs-title class_\">Object\u003C/span>.\u003Cspan class=\"hljs-title function_\">entries\u003C/span>(attributes)\n            .\u003Cspan class=\"hljs-title function_\">map\u003C/span>(\u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">[key, value]\u003C/span>) =&gt;\u003C/span> \u003Cspan class=\"hljs-string\">`\u003Cspan class=\"hljs-subst\">${key}\u003C/span>=&quot;\u003Cspan class=\"hljs-subst\">${value}\u003C/span>&quot;`\u003C/span>)\n            .\u003Cspan class=\"hljs-title function_\">join\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27; &#x27;\u003C/span>);\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">`&lt;a href=&quot;mailto:\u003Cspan class=\"hljs-subst\">${email}\u003C/span>&quot;\u003Cspan class=\"hljs-subst\">${attributeString ? \u003Cspan class=\"hljs-string\">&#x27; &#x27;\u003C/span> + attributeString : \u003Cspan class=\"hljs-string\">&#x27;&#x27;\u003C/span>}\u003C/span>&gt;\u003Cspan class=\"hljs-subst\">${email}\u003C/span>&lt;/a&gt;`\u003C/span>;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">createPhoneLink\u003C/span>(\u003Cspan class=\"hljs-params\">phoneNumber, displayText\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> attributes = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">buildLinkAttributes\u003C/span>(\u003Cspan class=\"hljs-string\">`tel:\u003Cspan class=\"hljs-subst\">${phoneNumber}\u003C/span>`\u003C/span>);\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> attributeString = \u003Cspan class=\"hljs-title class_\">Object\u003C/span>.\u003Cspan class=\"hljs-title function_\">entries\u003C/span>(attributes)\n            .\u003Cspan class=\"hljs-title function_\">map\u003C/span>(\u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">[key, value]\u003C/span>) =&gt;\u003C/span> \u003Cspan class=\"hljs-string\">`\u003Cspan class=\"hljs-subst\">${key}\u003C/span>=&quot;\u003Cspan class=\"hljs-subst\">${value}\u003C/span>&quot;`\u003C/span>)\n            .\u003Cspan class=\"hljs-title function_\">join\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27; &#x27;\u003C/span>);\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">`&lt;a href=&quot;tel:\u003Cspan class=\"hljs-subst\">${phoneNumber}\u003C/span>&quot;\u003Cspan class=\"hljs-subst\">${attributeString ? \u003Cspan class=\"hljs-string\">&#x27; &#x27;\u003C/span> + attributeString : \u003Cspan class=\"hljs-string\">&#x27;&#x27;\u003C/span>}\u003C/span>&gt;\u003Cspan class=\"hljs-subst\">${displayText}\u003C/span>&lt;/a&gt;`\u003C/span>;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">createHashtagLink\u003C/span>(\u003Cspan class=\"hljs-params\">hashtag\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> tag = hashtag.\u003Cspan class=\"hljs-title function_\">substring\u003C/span>(\u003Cspan class=\"hljs-number\">1\u003C/span>); \u003Cspan class=\"hljs-comment\">// Remove #\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> url = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">hashtagUrlTemplate\u003C/span> \n            ? \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">hashtagUrlTemplate\u003C/span>.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;{tag}&#x27;\u003C/span>, tag)\n            : \u003Cspan class=\"hljs-string\">`#\u003Cspan class=\"hljs-subst\">${tag}\u003C/span>`\u003C/span>;\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">`&lt;a href=&quot;\u003Cspan class=\"hljs-subst\">${url}\u003C/span>&quot; class=&quot;hashtag&quot;&gt;\u003Cspan class=\"hljs-subst\">${hashtag}\u003C/span>&lt;/a&gt;`\u003C/span>;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">createMentionLink\u003C/span>(\u003Cspan class=\"hljs-params\">mention\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> username = mention.\u003Cspan class=\"hljs-title function_\">substring\u003C/span>(\u003Cspan class=\"hljs-number\">1\u003C/span>); \u003Cspan class=\"hljs-comment\">// Remove @\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> url = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">mentionUrlTemplate\u003C/span> \n            ? \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">mentionUrlTemplate\u003C/span>.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;{username}&#x27;\u003C/span>, username)\n            : \u003Cspan class=\"hljs-string\">`#\u003Cspan class=\"hljs-subst\">${mention}\u003C/span>`\u003C/span>;\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">`&lt;a href=&quot;\u003Cspan class=\"hljs-subst\">${url}\u003C/span>&quot; class=&quot;mention&quot;&gt;\u003Cspan class=\"hljs-subst\">${mention}\u003C/span>&lt;/a&gt;`\u003C/span>;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">buildLinkAttributes\u003C/span>(\u003Cspan class=\"hljs-params\">url\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> attributes = { ...\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">linkAttributes\u003C/span> };\n        \n        \u003Cspan class=\"hljs-comment\">// Add target=&quot;_blank&quot; for external links if configured\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">openExternalInNewWindow\u003C/span> &amp;&amp; \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">isExternalUrl\u003C/span>(url)) {\n            attributes.\u003Cspan class=\"hljs-property\">target\u003C/span> = \u003Cspan class=\"hljs-string\">&#x27;_blank&#x27;\u003C/span>;\n            attributes.\u003Cspan class=\"hljs-property\">rel\u003C/span> = \u003Cspan class=\"hljs-string\">&#x27;noopener noreferrer&#x27;\u003C/span>;\n        }\n        \n        \u003Cspan class=\"hljs-comment\">// Add additional security attributes\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">addSecurityAttributes\u003C/span>) {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">isExternalUrl\u003C/span>(url)) {\n                attributes.\u003Cspan class=\"hljs-property\">rel\u003C/span> = attributes.\u003Cspan class=\"hljs-property\">rel\u003C/span> \n                    ? \u003Cspan class=\"hljs-string\">`\u003Cspan class=\"hljs-subst\">${attributes.rel}\u003C/span> nofollow`\u003C/span>\n                    : \u003Cspan class=\"hljs-string\">&#x27;nofollow&#x27;\u003C/span>;\n            }\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> attributes;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">isExternalUrl\u003C/span>(\u003Cspan class=\"hljs-params\">url\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">try\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> urlObj = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title function_\">URL\u003C/span>(url);\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> currentHost = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">baseHost\u003C/span> || \u003Cspan class=\"hljs-string\">&#x27;localhost&#x27;\u003C/span>;\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> urlObj.\u003Cspan class=\"hljs-property\">hostname\u003C/span> !== currentHost;\n        } \u003Cspan class=\"hljs-keyword\">catch\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">false\u003C/span>;\n        }\n    }\n    \n    \u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-title function_\">processMarkdownFile\u003C/span>(\u003Cspan class=\"hljs-params\">filePath\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> fs = \u003Cspan class=\"hljs-built_in\">require\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;fs&#x27;\u003C/span>).\u003Cspan class=\"hljs-property\">promises\u003C/span>;\n        \n        \u003Cspan class=\"hljs-keyword\">try\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> content = \u003Cspan class=\"hljs-keyword\">await\u003C/span> fs.\u003Cspan class=\"hljs-title function_\">readFile\u003C/span>(filePath, \u003Cspan class=\"hljs-string\">&#x27;utf8&#x27;\u003C/span>);\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> processedContent = \u003Cspan class=\"hljs-keyword\">await\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">processContent\u003C/span>(content);\n            \n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (content !== processedContent) {\n                \u003Cspan class=\"hljs-keyword\">await\u003C/span> fs.\u003Cspan class=\"hljs-title function_\">writeFile\u003C/span>(filePath, processedContent);\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> { \u003Cspan class=\"hljs-attr\">processed\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>, \u003Cspan class=\"hljs-attr\">changes\u003C/span>: \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">getChangeCount\u003C/span>(content, processedContent) };\n            }\n            \n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> { \u003Cspan class=\"hljs-attr\">processed\u003C/span>: \u003Cspan class=\"hljs-literal\">false\u003C/span>, \u003Cspan class=\"hljs-attr\">changes\u003C/span>: \u003Cspan class=\"hljs-number\">0\u003C/span> };\n            \n        } \u003Cspan class=\"hljs-keyword\">catch\u003C/span> (error) {\n            \u003Cspan class=\"hljs-keyword\">throw\u003C/span> \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">Error\u003C/span>(\u003Cspan class=\"hljs-string\">`Failed to process \u003Cspan class=\"hljs-subst\">${filePath}\u003C/span>: \u003Cspan class=\"hljs-subst\">${error.message}\u003C/span>`\u003C/span>);\n        }\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">getChangeCount\u003C/span>(\u003Cspan class=\"hljs-params\">original, processed\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Count number of links added\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> originalLinkCount = (original.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/&lt;a\\s+[^&gt;]*href/g\u003C/span>) || []).\u003Cspan class=\"hljs-property\">length\u003C/span>;\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> processedLinkCount = (processed.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/&lt;a\\s+[^&gt;]*href/g\u003C/span>) || []).\u003Cspan class=\"hljs-property\">length\u003C/span>;\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> processedLinkCount - originalLinkCount;\n    }\n    \n    \u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-title function_\">batchProcessFiles\u003C/span>(\u003Cspan class=\"hljs-params\">filePaths, options = {}\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> results = {\n            \u003Cspan class=\"hljs-attr\">processed\u003C/span>: [],\n            \u003Cspan class=\"hljs-attr\">errors\u003C/span>: [],\n            \u003Cspan class=\"hljs-attr\">summary\u003C/span>: {\n                \u003Cspan class=\"hljs-attr\">totalFiles\u003C/span>: filePaths.\u003Cspan class=\"hljs-property\">length\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">processedFiles\u003C/span>: \u003Cspan class=\"hljs-number\">0\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">totalLinks\u003C/span>: \u003Cspan class=\"hljs-number\">0\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">errors\u003C/span>: \u003Cspan class=\"hljs-number\">0\u003C/span>\n            }\n        };\n        \n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> concurrency = options.\u003Cspan class=\"hljs-property\">concurrency\u003C/span> || \u003Cspan class=\"hljs-number\">5\u003C/span>;\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> chunks = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">chunkArray\u003C/span>(filePaths, concurrency);\n        \n        \u003Cspan class=\"hljs-keyword\">for\u003C/span> (\u003Cspan class=\"hljs-keyword\">const\u003C/span> chunk \u003Cspan class=\"hljs-keyword\">of\u003C/span> chunks) {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> promises = chunk.\u003Cspan class=\"hljs-title function_\">map\u003C/span>(\u003Cspan class=\"hljs-keyword\">async\u003C/span> filePath =&gt; {\n                \u003Cspan class=\"hljs-keyword\">try\u003C/span> {\n                    \u003Cspan class=\"hljs-keyword\">const\u003C/span> result = \u003Cspan class=\"hljs-keyword\">await\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">processMarkdownFile\u003C/span>(filePath);\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> { filePath, ...result };\n                } \u003Cspan class=\"hljs-keyword\">catch\u003C/span> (error) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> { filePath, \u003Cspan class=\"hljs-attr\">error\u003C/span>: error.\u003Cspan class=\"hljs-property\">message\u003C/span> };\n                }\n            });\n            \n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> chunkResults = \u003Cspan class=\"hljs-keyword\">await\u003C/span> \u003Cspan class=\"hljs-title class_\">Promise\u003C/span>.\u003Cspan class=\"hljs-title function_\">all\u003C/span>(promises);\n            \n            chunkResults.\u003Cspan class=\"hljs-title function_\">forEach\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">result\u003C/span> =&gt;\u003C/span> {\n                \u003Cspan class=\"hljs-keyword\">if\u003C/span> (result.\u003Cspan class=\"hljs-property\">error\u003C/span>) {\n                    results.\u003Cspan class=\"hljs-property\">errors\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>(result);\n                    results.\u003Cspan class=\"hljs-property\">summary\u003C/span>.\u003Cspan class=\"hljs-property\">errors\u003C/span>++;\n                } \u003Cspan class=\"hljs-keyword\">else\u003C/span> {\n                    results.\u003Cspan class=\"hljs-property\">processed\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>(result);\n                    \u003Cspan class=\"hljs-keyword\">if\u003C/span> (result.\u003Cspan class=\"hljs-property\">processed\u003C/span>) {\n                        results.\u003Cspan class=\"hljs-property\">summary\u003C/span>.\u003Cspan class=\"hljs-property\">processedFiles\u003C/span>++;\n                        results.\u003Cspan class=\"hljs-property\">summary\u003C/span>.\u003Cspan class=\"hljs-property\">totalLinks\u003C/span> += result.\u003Cspan class=\"hljs-property\">changes\u003C/span>;\n                    }\n                }\n            });\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> results;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">chunkArray\u003C/span>(\u003Cspan class=\"hljs-params\">array, chunkSize\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> chunks = [];\n        \u003Cspan class=\"hljs-keyword\">for\u003C/span> (\u003Cspan class=\"hljs-keyword\">let\u003C/span> i = \u003Cspan class=\"hljs-number\">0\u003C/span>; i &lt; array.\u003Cspan class=\"hljs-property\">length\u003C/span>; i += chunkSize) {\n            chunks.\u003Cspan class=\"hljs-title function_\">push\u003C/span>(array.\u003Cspan class=\"hljs-title function_\">slice\u003C/span>(i, i + chunkSize));\n        }\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> chunks;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">generateReport\u003C/span>(\u003Cspan class=\"hljs-params\">batchResults\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> report = {\n            \u003Cspan class=\"hljs-attr\">timestamp\u003C/span>: \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">Date\u003C/span>().\u003Cspan class=\"hljs-title function_\">toISOString\u003C/span>(),\n            \u003Cspan class=\"hljs-attr\">summary\u003C/span>: batchResults.\u003Cspan class=\"hljs-property\">summary\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">processedFiles\u003C/span>: batchResults.\u003Cspan class=\"hljs-property\">processed\u003C/span>.\u003Cspan class=\"hljs-title function_\">filter\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">f\u003C/span> =&gt;\u003C/span> f.\u003Cspan class=\"hljs-property\">processed\u003C/span>),\n            \u003Cspan class=\"hljs-attr\">errors\u003C/span>: batchResults.\u003Cspan class=\"hljs-property\">errors\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">recommendations\u003C/span>: []\n        };\n        \n        \u003Cspan class=\"hljs-comment\">// Generate recommendations\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (report.\u003Cspan class=\"hljs-property\">summary\u003C/span>.\u003Cspan class=\"hljs-property\">errors\u003C/span> &gt; \u003Cspan class=\"hljs-number\">0\u003C/span>) {\n            report.\u003Cspan class=\"hljs-property\">recommendations\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                \u003Cspan class=\"hljs-attr\">type\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;error-handling&#x27;\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">priority\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;high&#x27;\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">message\u003C/span>: \u003Cspan class=\"hljs-string\">`\u003Cspan class=\"hljs-subst\">${report.summary.errors}\u003C/span> files had processing errors. Review error details and fix issues.`\u003C/span>\n            });\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (report.\u003Cspan class=\"hljs-property\">summary\u003C/span>.\u003Cspan class=\"hljs-property\">totalLinks\u003C/span> === \u003Cspan class=\"hljs-number\">0\u003C/span>) {\n            report.\u003Cspan class=\"hljs-property\">recommendations\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                \u003Cspan class=\"hljs-attr\">type\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;no-links-found&#x27;\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">priority\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;medium&#x27;\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">message\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;No auto-linkable content found. Consider reviewing URL patterns or enabling additional link types.&#x27;\u003C/span>\n            });\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> avgLinksPerFile = report.\u003Cspan class=\"hljs-property\">summary\u003C/span>.\u003Cspan class=\"hljs-property\">totalLinks\u003C/span> / \u003Cspan class=\"hljs-title class_\">Math\u003C/span>.\u003Cspan class=\"hljs-title function_\">max\u003C/span>(report.\u003Cspan class=\"hljs-property\">summary\u003C/span>.\u003Cspan class=\"hljs-property\">processedFiles\u003C/span>, \u003Cspan class=\"hljs-number\">1\u003C/span>);\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (avgLinksPerFile &gt; \u003Cspan class=\"hljs-number\">10\u003C/span>) {\n            report.\u003Cspan class=\"hljs-property\">recommendations\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                \u003Cspan class=\"hljs-attr\">type\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;high-link-density&#x27;\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">priority\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;low&#x27;\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">message\u003C/span>: \u003Cspan class=\"hljs-string\">`High average of \u003Cspan class=\"hljs-subst\">${avgLinksPerFile.toFixed(\u003Cspan class=\"hljs-number\">1\u003C/span>)}\u003C/span> links per file. Consider manual review for readability.`\u003C/span>\n            });\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> report;\n    }\n}\n\n\u003Cspan class=\"hljs-comment\">// Usage examples and configuration\u003C/span>\n\u003Cspan class=\"hljs-keyword\">function\u003C/span> \u003Cspan class=\"hljs-title function_\">demonstrateAutoLinking\u003C/span>(\u003Cspan class=\"hljs-params\">\u003C/span>) {\n    \u003Cspan class=\"hljs-comment\">// Basic auto-linking configuration\u003C/span>\n    \u003Cspan class=\"hljs-keyword\">const\u003C/span> basicLinker = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">AdvancedAutoLinker\u003C/span>({\n        \u003Cspan class=\"hljs-attr\">autoLinkUrls\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">autoLinkEmails\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">openExternalInNewWindow\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">addSecurityAttributes\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>\n    });\n    \n    \u003Cspan class=\"hljs-comment\">// Advanced configuration with custom patterns\u003C/span>\n    \u003Cspan class=\"hljs-keyword\">const\u003C/span> advancedLinker = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">AdvancedAutoLinker\u003C/span>({\n        \u003Cspan class=\"hljs-attr\">autoLinkUrls\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">autoLinkEmails\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">autoLinkPhones\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">autoLinkHashtags\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">autoLinkMentions\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">validateUrls\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">customProtocols\u003C/span>: [\u003Cspan class=\"hljs-string\">&#x27;slack&#x27;\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;zoom&#x27;\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;teams&#x27;\u003C/span>],\n        \u003Cspan class=\"hljs-attr\">hashtagUrlTemplate\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;/tags/{tag}&#x27;\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">mentionUrlTemplate\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;/users/{username}&#x27;\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">linkAttributes\u003C/span>: {\n            \u003Cspan class=\"hljs-attr\">class\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;auto-link&#x27;\u003C/span>,\n            \u003Cspan class=\"hljs-string\">&#x27;data-auto-generated&#x27;\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;true&#x27;\u003C/span>\n        },\n        \u003Cspan class=\"hljs-attr\">excludePatterns\u003C/span>: [\n            \u003Cspan class=\"hljs-regexp\">/example\\.com/i\u003C/span>,\n            \u003Cspan class=\"hljs-regexp\">/localhost/i\u003C/span>,\n            \u003Cspan class=\"hljs-regexp\">/127\\.0\\.0\\.1/\u003C/span>\n        ]\n    });\n    \n    \u003Cspan class=\"hljs-comment\">// Example content processing\u003C/span>\n    \u003Cspan class=\"hljs-keyword\">const\u003C/span> content = \u003Cspan class=\"hljs-string\">`\n    Check out https://github.com/user/repo for the source code.\n    Contact us at support@company.com for help.\n    Call us at (555) 123-4567 for immediate assistance.\n    Follow the discussion at #webdev and mention @developer.\n    `\u003C/span>;\n    \n    \u003Cspan class=\"hljs-variable language_\">console\u003C/span>.\u003Cspan class=\"hljs-title function_\">log\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;Processing content with advanced auto-linking...&#x27;\u003C/span>);\n    advancedLinker.\u003Cspan class=\"hljs-title function_\">processContent\u003C/span>(content).\u003Cspan class=\"hljs-title function_\">then\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">result\u003C/span> =&gt;\u003C/span> {\n        \u003Cspan class=\"hljs-variable language_\">console\u003C/span>.\u003Cspan class=\"hljs-title function_\">log\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;Processed content:&#x27;\u003C/span>, result);\n    });\n}\n\n\u003Cspan class=\"hljs-variable language_\">module\u003C/span>.\u003Cspan class=\"hljs-property\">exports\u003C/span> = \u003Cspan class=\"hljs-title class_\">AdvancedAutoLinker\u003C/span>;\n\u003C/code>\u003C/pre>\u003Ch2 id=\"advanced-url-recognition-patterns\">Advanced URL Recognition Patterns\u003C/h2>\n\u003Ch3 id=\"complex-url-pattern-matching\">Complex URL Pattern Matching\u003C/h3>\n\u003Cp>Handling sophisticated URL recognition scenarios:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-javascript\">\u003Cspan class=\"hljs-comment\">// url-pattern-matcher.js - Advanced URL pattern recognition\u003C/span>\n\u003Cspan class=\"hljs-keyword\">class\u003C/span> \u003Cspan class=\"hljs-title class_\">URLPatternMatcher\u003C/span> {\n    \u003Cspan class=\"hljs-title function_\">constructor\u003C/span>(\u003Cspan class=\"hljs-params\">\u003C/span>) {\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">patterns\u003C/span> = {\n            \u003Cspan class=\"hljs-comment\">// Standard web URLs\u003C/span>\n            \u003Cspan class=\"hljs-attr\">web\u003C/span>: \u003Cspan class=\"hljs-regexp\">/https?:\\/\\/(?:[-\\w.])+(?:\\:[0-9]+)?(?:\\/(?:[\\w\\/_.])*)?(?:\\?(?:[\\w&amp;=%.])*)?(?:\\#(?:[\\w.])*)?/g\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// File transfer protocols\u003C/span>\n            \u003Cspan class=\"hljs-attr\">ftp\u003C/span>: \u003Cspan class=\"hljs-regexp\">/ftp:\\/\\/(?:[-\\w.])+(?:\\:[0-9]+)?(?:\\/(?:[\\w\\/_.])*)?/g\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// Email addresses (RFC 5322 compliant)\u003C/span>\n            \u003Cspan class=\"hljs-attr\">email\u003C/span>: \u003Cspan class=\"hljs-regexp\">/(?:[a-z0-9!#$%&amp;&#x27;*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&amp;&#x27;*+/=?^_`{|}~-]+)*|&quot;(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*&quot;)@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])/g\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// IP addresses\u003C/span>\n            \u003Cspan class=\"hljs-attr\">ipv4\u003C/span>: \u003Cspan class=\"hljs-regexp\">/(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/g\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">ipv6\u003C/span>: \u003Cspan class=\"hljs-regexp\">/(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}/g\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// Phone numbers (international formats)\u003C/span>\n            \u003Cspan class=\"hljs-attr\">phone\u003C/span>: \u003Cspan class=\"hljs-regexp\">/(?:\\+?1[-.\\s]?)?\\(?([0-9]{3})\\)?[-.\\s]?([0-9]{3})[-.\\s]?([0-9]{4})/g\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// Custom protocols\u003C/span>\n            \u003Cspan class=\"hljs-attr\">custom\u003C/span>: {\n                \u003Cspan class=\"hljs-attr\">slack\u003C/span>: \u003Cspan class=\"hljs-regexp\">/slack:\\/\\/(?:channel|user)\\/[A-Z0-9]+/g\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">zoom\u003C/span>: \u003Cspan class=\"hljs-regexp\">/https?:\\/\\/(?:[\\w-]+\\.)?zoom\\.us\\/[jw]\\/\\d+/g\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">teams\u003C/span>: \u003Cspan class=\"hljs-regexp\">/https?:\\/\\/teams\\.microsoft\\.com\\/l\\/meetup-join\\/[^?\\s]+/g\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">github\u003C/span>: \u003Cspan class=\"hljs-regexp\">/https?:\\/\\/github\\.com\\/[\\w.-]+\\/[\\w.-]+/g\u003C/span>\n            }\n        };\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">detectUrls\u003C/span>(\u003Cspan class=\"hljs-params\">text, options = {}\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> detectedUrls = [];\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> types = options.\u003Cspan class=\"hljs-property\">types\u003C/span> || \u003Cspan class=\"hljs-title class_\">Object\u003C/span>.\u003Cspan class=\"hljs-title function_\">keys\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">patterns\u003C/span>);\n        \n        types.\u003Cspan class=\"hljs-title function_\">forEach\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">type\u003C/span> =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (type === \u003Cspan class=\"hljs-string\">&#x27;custom&#x27;\u003C/span>) {\n                \u003Cspan class=\"hljs-title class_\">Object\u003C/span>.\u003Cspan class=\"hljs-title function_\">entries\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">patterns\u003C/span>.\u003Cspan class=\"hljs-property\">custom\u003C/span>).\u003Cspan class=\"hljs-title function_\">forEach\u003C/span>(\u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">[customType, pattern]\u003C/span>) =&gt;\u003C/span> {\n                    \u003Cspan class=\"hljs-keyword\">if\u003C/span> (options.\u003Cspan class=\"hljs-property\">customTypes\u003C/span> &amp;&amp; options.\u003Cspan class=\"hljs-property\">customTypes\u003C/span>.\u003Cspan class=\"hljs-title function_\">includes\u003C/span>(customType)) {\n                        \u003Cspan class=\"hljs-keyword\">const\u003C/span> matches = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">findMatches\u003C/span>(text, pattern, customType);\n                        detectedUrls.\u003Cspan class=\"hljs-title function_\">push\u003C/span>(...matches);\n                    }\n                });\n            } \u003Cspan class=\"hljs-keyword\">else\u003C/span> {\n                \u003Cspan class=\"hljs-keyword\">const\u003C/span> matches = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">findMatches\u003C/span>(text, \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">patterns\u003C/span>[type], type);\n                detectedUrls.\u003Cspan class=\"hljs-title function_\">push\u003C/span>(...matches);\n            }\n        });\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">deduplicateUrls\u003C/span>(detectedUrls);\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">findMatches\u003C/span>(\u003Cspan class=\"hljs-params\">text, pattern, type\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> matches = [];\n        \u003Cspan class=\"hljs-keyword\">let\u003C/span> match;\n        \n        \u003Cspan class=\"hljs-keyword\">while\u003C/span> ((match = pattern.\u003Cspan class=\"hljs-title function_\">exec\u003C/span>(text)) !== \u003Cspan class=\"hljs-literal\">null\u003C/span>) {\n            matches.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                \u003Cspan class=\"hljs-attr\">url\u003C/span>: match[\u003Cspan class=\"hljs-number\">0\u003C/span>],\n                \u003Cspan class=\"hljs-attr\">type\u003C/span>: type,\n                \u003Cspan class=\"hljs-attr\">start\u003C/span>: match.\u003Cspan class=\"hljs-property\">index\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">end\u003C/span>: match.\u003Cspan class=\"hljs-property\">index\u003C/span> + match[\u003Cspan class=\"hljs-number\">0\u003C/span>].\u003Cspan class=\"hljs-property\">length\u003C/span>,\n                \u003Cspan class=\"hljs-attr\">context\u003C/span>: \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">getContext\u003C/span>(text, match.\u003Cspan class=\"hljs-property\">index\u003C/span>, match[\u003Cspan class=\"hljs-number\">0\u003C/span>].\u003Cspan class=\"hljs-property\">length\u003C/span>)\n            });\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> matches;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">getContext\u003C/span>(\u003Cspan class=\"hljs-params\">text, start, length, contextSize = \u003Cspan class=\"hljs-number\">20\u003C/span>\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> before = text.\u003Cspan class=\"hljs-title function_\">substring\u003C/span>(\n            \u003Cspan class=\"hljs-title class_\">Math\u003C/span>.\u003Cspan class=\"hljs-title function_\">max\u003C/span>(\u003Cspan class=\"hljs-number\">0\u003C/span>, start - contextSize), \n            start\n        );\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> after = text.\u003Cspan class=\"hljs-title function_\">substring\u003C/span>(\n            start + length,\n            \u003Cspan class=\"hljs-title class_\">Math\u003C/span>.\u003Cspan class=\"hljs-title function_\">min\u003C/span>(text.\u003Cspan class=\"hljs-property\">length\u003C/span>, start + length + contextSize)\n        );\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> { before, after };\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">deduplicateUrls\u003C/span>(\u003Cspan class=\"hljs-params\">urls\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> seen = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">Set\u003C/span>();\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> urls.\u003Cspan class=\"hljs-title function_\">filter\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">urlData\u003C/span> =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (seen.\u003Cspan class=\"hljs-title function_\">has\u003C/span>(urlData.\u003Cspan class=\"hljs-property\">url\u003C/span>)) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">false\u003C/span>;\n            }\n            seen.\u003Cspan class=\"hljs-title function_\">add\u003C/span>(urlData.\u003Cspan class=\"hljs-property\">url\u003C/span>);\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">true\u003C/span>;\n        });\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">validateUrl\u003C/span>(\u003Cspan class=\"hljs-params\">url, type\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">switch\u003C/span> (type) {\n            \u003Cspan class=\"hljs-keyword\">case\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;web&#x27;\u003C/span>:\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">validateWebUrl\u003C/span>(url);\n            \u003Cspan class=\"hljs-keyword\">case\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;email&#x27;\u003C/span>:\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">validateEmail\u003C/span>(url);\n            \u003Cspan class=\"hljs-keyword\">case\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;phone&#x27;\u003C/span>:\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">validatePhone\u003C/span>(url);\n            \u003Cspan class=\"hljs-attr\">default\u003C/span>:\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">true\u003C/span>;\n        }\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">validateWebUrl\u003C/span>(\u003Cspan class=\"hljs-params\">url\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">try\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> urlObj = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title function_\">URL\u003C/span>(url);\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> [\u003Cspan class=\"hljs-string\">&#x27;http:&#x27;\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;https:&#x27;\u003C/span>].\u003Cspan class=\"hljs-title function_\">includes\u003C/span>(urlObj.\u003Cspan class=\"hljs-property\">protocol\u003C/span>);\n        } \u003Cspan class=\"hljs-keyword\">catch\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">false\u003C/span>;\n        }\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">validateEmail\u003C/span>(\u003Cspan class=\"hljs-params\">email\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Additional email validation beyond regex\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> parts = email.\u003Cspan class=\"hljs-title function_\">split\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;@&#x27;\u003C/span>);\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (parts.\u003Cspan class=\"hljs-property\">length\u003C/span> !== \u003Cspan class=\"hljs-number\">2\u003C/span>) \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">false\u003C/span>;\n        \n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> [local, domain] = parts;\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> local.\u003Cspan class=\"hljs-property\">length\u003C/span> &lt;= \u003Cspan class=\"hljs-number\">64\u003C/span> &amp;&amp; domain.\u003Cspan class=\"hljs-property\">length\u003C/span> &lt;= \u003Cspan class=\"hljs-number\">253\u003C/span>;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">validatePhone\u003C/span>(\u003Cspan class=\"hljs-params\">phone\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Basic phone number validation\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> digits = phone.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-regexp\">/\\D/g\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;&#x27;\u003C/span>);\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> digits.\u003Cspan class=\"hljs-property\">length\u003C/span> &gt;= \u003Cspan class=\"hljs-number\">10\u003C/span> &amp;&amp; digits.\u003Cspan class=\"hljs-property\">length\u003C/span> &lt;= \u003Cspan class=\"hljs-number\">15\u003C/span>;\n    }\n}\n\u003C/code>\u003C/pre>\u003Ch3 id=\"smart-context-aware-link-generation\">Smart Context-Aware Link Generation\u003C/h3>\n\u003Cp>Implementing intelligent link generation based on content context:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-javascript\">\u003Cspan class=\"hljs-comment\">// context-aware-linker.js - Smart context-based link generation\u003C/span>\n\u003Cspan class=\"hljs-keyword\">class\u003C/span> \u003Cspan class=\"hljs-title class_\">ContextAwareLinkGenerator\u003C/span> {\n    \u003Cspan class=\"hljs-title function_\">constructor\u003C/span>(\u003Cspan class=\"hljs-params\">options = {}\u003C/span>) {\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span> = {\n            \u003Cspan class=\"hljs-attr\">contextRadius\u003C/span>: options.\u003Cspan class=\"hljs-property\">contextRadius\u003C/span> || \u003Cspan class=\"hljs-number\">50\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">knowledgeBase\u003C/span>: options.\u003Cspan class=\"hljs-property\">knowledgeBase\u003C/span> || \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">Map\u003C/span>(),\n            \u003Cspan class=\"hljs-attr\">linkTemplates\u003C/span>: options.\u003Cspan class=\"hljs-property\">linkTemplates\u003C/span> || {},\n            \u003Cspan class=\"hljs-attr\">confidenceThreshold\u003C/span>: options.\u003Cspan class=\"hljs-property\">confidenceThreshold\u003C/span> || \u003Cspan class=\"hljs-number\">0.7\u003C/span>,\n            ...options\n        };\n        \n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">entityRecognizer\u003C/span> = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">EntityRecognizer\u003C/span>();\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">linkSuggester\u003C/span> = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">LinkSuggester\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">knowledgeBase\u003C/span>);\n    }\n    \n    \u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-title function_\">generateContextualLinks\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Analyze content structure\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> contentStructure = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">analyzeContentStructure\u003C/span>(content);\n        \n        \u003Cspan class=\"hljs-comment\">// Extract entities and concepts\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> entities = \u003Cspan class=\"hljs-keyword\">await\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">entityRecognizer\u003C/span>.\u003Cspan class=\"hljs-title function_\">extractEntities\u003C/span>(content);\n        \n        \u003Cspan class=\"hljs-comment\">// Generate link suggestions\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> linkSuggestions = \u003Cspan class=\"hljs-keyword\">await\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">linkSuggester\u003C/span>.\u003Cspan class=\"hljs-title function_\">generateSuggestions\u003C/span>(\n            entities, \n            contentStructure\n        );\n        \n        \u003Cspan class=\"hljs-comment\">// Apply links with confidence scoring\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> linkedContent = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">applyContextualLinks\u003C/span>(\n            content, \n            linkSuggestions\n        );\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> {\n            \u003Cspan class=\"hljs-attr\">content\u003C/span>: linkedContent,\n            \u003Cspan class=\"hljs-attr\">suggestions\u003C/span>: linkSuggestions,\n            \u003Cspan class=\"hljs-attr\">entities\u003C/span>: entities,\n            \u003Cspan class=\"hljs-attr\">statistics\u003C/span>: \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">calculateLinkingStatistics\u003C/span>(linkSuggestions)\n        };\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">analyzeContentStructure\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> structure = {\n            \u003Cspan class=\"hljs-attr\">headings\u003C/span>: [],\n            \u003Cspan class=\"hljs-attr\">codeBlocks\u003C/span>: [],\n            \u003Cspan class=\"hljs-attr\">lists\u003C/span>: [],\n            \u003Cspan class=\"hljs-attr\">paragraphs\u003C/span>: [],\n            \u003Cspan class=\"hljs-attr\">links\u003C/span>: []\n        };\n        \n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> lines = content.\u003Cspan class=\"hljs-title function_\">split\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;\\n&#x27;\u003C/span>);\n        \n        lines.\u003Cspan class=\"hljs-title function_\">forEach\u003C/span>(\u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">line, index\u003C/span>) =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-comment\">// Detect headings\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> headingMatch = line.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/^(#{1,6})\\s+(.+)$/\u003C/span>);\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (headingMatch) {\n                structure.\u003Cspan class=\"hljs-property\">headings\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                    \u003Cspan class=\"hljs-attr\">level\u003C/span>: headingMatch[\u003Cspan class=\"hljs-number\">1\u003C/span>].\u003Cspan class=\"hljs-property\">length\u003C/span>,\n                    \u003Cspan class=\"hljs-attr\">text\u003C/span>: headingMatch[\u003Cspan class=\"hljs-number\">2\u003C/span>],\n                    \u003Cspan class=\"hljs-attr\">line\u003C/span>: index\n                });\n            }\n            \n            \u003Cspan class=\"hljs-comment\">// Detect code blocks\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (line.\u003Cspan class=\"hljs-title function_\">startsWith\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;```&#x27;\u003C/span>)) {\n                structure.\u003Cspan class=\"hljs-property\">codeBlocks\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({ \u003Cspan class=\"hljs-attr\">line\u003C/span>: index });\n            }\n            \n            \u003Cspan class=\"hljs-comment\">// Detect lists\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (line.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/^[\\s]*[-*+]\\s/\u003C/span>)) {\n                structure.\u003Cspan class=\"hljs-property\">lists\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({ \u003Cspan class=\"hljs-attr\">line\u003C/span>: index, \u003Cspan class=\"hljs-attr\">text\u003C/span>: line.\u003Cspan class=\"hljs-title function_\">trim\u003C/span>() });\n            }\n            \n            \u003Cspan class=\"hljs-comment\">// Detect existing links\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> linkMatches = line.\u003Cspan class=\"hljs-title function_\">matchAll\u003C/span>(\u003Cspan class=\"hljs-regexp\">/\\[([^\\]]+)\\]\\(([^)]+)\\)/g\u003C/span>);\n            \u003Cspan class=\"hljs-keyword\">for\u003C/span> (\u003Cspan class=\"hljs-keyword\">const\u003C/span> match \u003Cspan class=\"hljs-keyword\">of\u003C/span> linkMatches) {\n                structure.\u003Cspan class=\"hljs-property\">links\u003C/span>.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                    \u003Cspan class=\"hljs-attr\">text\u003C/span>: match[\u003Cspan class=\"hljs-number\">1\u003C/span>],\n                    \u003Cspan class=\"hljs-attr\">url\u003C/span>: match[\u003Cspan class=\"hljs-number\">2\u003C/span>],\n                    \u003Cspan class=\"hljs-attr\">line\u003C/span>: index\n                });\n            }\n        });\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> structure;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">applyContextualLinks\u003C/span>(\u003Cspan class=\"hljs-params\">content, suggestions\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">let\u003C/span> linkedContent = content;\n        \n        \u003Cspan class=\"hljs-comment\">// Sort suggestions by position (descending) to maintain text positions\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> sortedSuggestions = suggestions\n            .\u003Cspan class=\"hljs-title function_\">filter\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">s\u003C/span> =&gt;\u003C/span> s.\u003Cspan class=\"hljs-property\">confidence\u003C/span> &gt;= \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">options\u003C/span>.\u003Cspan class=\"hljs-property\">confidenceThreshold\u003C/span>)\n            .\u003Cspan class=\"hljs-title function_\">sort\u003C/span>(\u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">a, b\u003C/span>) =&gt;\u003C/span> b.\u003Cspan class=\"hljs-property\">position\u003C/span> - a.\u003Cspan class=\"hljs-property\">position\u003C/span>);\n        \n        sortedSuggestions.\u003Cspan class=\"hljs-title function_\">forEach\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">suggestion\u003C/span> =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> beforeText = linkedContent.\u003Cspan class=\"hljs-title function_\">substring\u003C/span>(\u003Cspan class=\"hljs-number\">0\u003C/span>, suggestion.\u003Cspan class=\"hljs-property\">position\u003C/span>);\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> afterText = linkedContent.\u003Cspan class=\"hljs-title function_\">substring\u003C/span>(\n                suggestion.\u003Cspan class=\"hljs-property\">position\u003C/span> + suggestion.\u003Cspan class=\"hljs-property\">text\u003C/span>.\u003Cspan class=\"hljs-property\">length\u003C/span>\n            );\n            \n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> linkMarkdown = \u003Cspan class=\"hljs-string\">`[\u003Cspan class=\"hljs-subst\">${suggestion.text}\u003C/span>](\u003Cspan class=\"hljs-subst\">${suggestion.url}\u003C/span>)`\u003C/span>;\n            linkedContent = beforeText + linkMarkdown + afterText;\n        });\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> linkedContent;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">calculateLinkingStatistics\u003C/span>(\u003Cspan class=\"hljs-params\">suggestions\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> stats = {\n            \u003Cspan class=\"hljs-attr\">totalSuggestions\u003C/span>: suggestions.\u003Cspan class=\"hljs-property\">length\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">highConfidence\u003C/span>: \u003Cspan class=\"hljs-number\">0\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">mediumConfidence\u003C/span>: \u003Cspan class=\"hljs-number\">0\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">lowConfidence\u003C/span>: \u003Cspan class=\"hljs-number\">0\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">byType\u003C/span>: {}\n        };\n        \n        suggestions.\u003Cspan class=\"hljs-title function_\">forEach\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">suggestion\u003C/span> =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (suggestion.\u003Cspan class=\"hljs-property\">confidence\u003C/span> &gt;= \u003Cspan class=\"hljs-number\">0.8\u003C/span>) {\n                stats.\u003Cspan class=\"hljs-property\">highConfidence\u003C/span>++;\n            } \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> (suggestion.\u003Cspan class=\"hljs-property\">confidence\u003C/span> &gt;= \u003Cspan class=\"hljs-number\">0.6\u003C/span>) {\n                stats.\u003Cspan class=\"hljs-property\">mediumConfidence\u003C/span>++;\n            } \u003Cspan class=\"hljs-keyword\">else\u003C/span> {\n                stats.\u003Cspan class=\"hljs-property\">lowConfidence\u003C/span>++;\n            }\n            \n            stats.\u003Cspan class=\"hljs-property\">byType\u003C/span>[suggestion.\u003Cspan class=\"hljs-property\">type\u003C/span>] = (stats.\u003Cspan class=\"hljs-property\">byType\u003C/span>[suggestion.\u003Cspan class=\"hljs-property\">type\u003C/span>] || \u003Cspan class=\"hljs-number\">0\u003C/span>) + \u003Cspan class=\"hljs-number\">1\u003C/span>;\n        });\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> stats;\n    }\n}\n\n\u003Cspan class=\"hljs-keyword\">class\u003C/span> \u003Cspan class=\"hljs-title class_\">EntityRecognizer\u003C/span> {\n    \u003Cspan class=\"hljs-title function_\">constructor\u003C/span>(\u003Cspan class=\"hljs-params\">\u003C/span>) {\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">patterns\u003C/span> = {\n            \u003Cspan class=\"hljs-comment\">// Technical terms\u003C/span>\n            \u003Cspan class=\"hljs-attr\">technology\u003C/span>: \u003Cspan class=\"hljs-regexp\">/\\b(?:JavaScript|Python|React|Node\\.js|Docker|Kubernetes|AWS|GitHub|API|REST|GraphQL|SQL|NoSQL)\\b/gi\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// File extensions\u003C/span>\n            \u003Cspan class=\"hljs-attr\">files\u003C/span>: \u003Cspan class=\"hljs-regexp\">/\\b\\w+\\.(?:js|py|html|css|md|json|yml|yaml|xml|txt|pdf|doc|docx)\\b/gi\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// Version numbers\u003C/span>\n            \u003Cspan class=\"hljs-attr\">versions\u003C/span>: \u003Cspan class=\"hljs-regexp\">/v?\\d+\\.\\d+(?:\\.\\d+)?(?:-\\w+)?/gi\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// Command line tools\u003C/span>\n            \u003Cspan class=\"hljs-attr\">commands\u003C/span>: \u003Cspan class=\"hljs-regexp\">/\\b(?:git|npm|yarn|pip|docker|kubectl|curl|wget|ssh|scp)\\b/gi\u003C/span>,\n            \n            \u003Cspan class=\"hljs-comment\">// Dates\u003C/span>\n            \u003Cspan class=\"hljs-attr\">dates\u003C/span>: \u003Cspan class=\"hljs-regexp\">/\\b(?:\\d{1,2}[\\/\\-]\\d{1,2}[\\/\\-]\\d{2,4}|\\d{4}-\\d{2}-\\d{2})\\b/gi\u003C/span>\n        };\n    }\n    \n    \u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-title function_\">extractEntities\u003C/span>(\u003Cspan class=\"hljs-params\">content\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> entities = [];\n        \n        \u003Cspan class=\"hljs-title class_\">Object\u003C/span>.\u003Cspan class=\"hljs-title function_\">entries\u003C/span>(\u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">patterns\u003C/span>).\u003Cspan class=\"hljs-title function_\">forEach\u003C/span>(\u003Cspan class=\"hljs-function\">(\u003Cspan class=\"hljs-params\">[type, pattern]\u003C/span>) =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">let\u003C/span> match;\n            \u003Cspan class=\"hljs-keyword\">while\u003C/span> ((match = pattern.\u003Cspan class=\"hljs-title function_\">exec\u003C/span>(content)) !== \u003Cspan class=\"hljs-literal\">null\u003C/span>) {\n                entities.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                    \u003Cspan class=\"hljs-attr\">text\u003C/span>: match[\u003Cspan class=\"hljs-number\">0\u003C/span>],\n                    \u003Cspan class=\"hljs-attr\">type\u003C/span>: type,\n                    \u003Cspan class=\"hljs-attr\">position\u003C/span>: match.\u003Cspan class=\"hljs-property\">index\u003C/span>,\n                    \u003Cspan class=\"hljs-attr\">confidence\u003C/span>: \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">calculateEntityConfidence\u003C/span>(match[\u003Cspan class=\"hljs-number\">0\u003C/span>], type)\n                });\n            }\n        });\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">deduplicateEntities\u003C/span>(entities);\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">calculateEntityConfidence\u003C/span>(\u003Cspan class=\"hljs-params\">text, type\u003C/span>) {\n        \u003Cspan class=\"hljs-comment\">// Simple confidence scoring based on entity type and length\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">let\u003C/span> confidence = \u003Cspan class=\"hljs-number\">0.5\u003C/span>;\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> (type === \u003Cspan class=\"hljs-string\">&#x27;technology&#x27;\u003C/span> &amp;&amp; text.\u003Cspan class=\"hljs-property\">length\u003C/span> &gt; \u003Cspan class=\"hljs-number\">3\u003C/span>) {\n            confidence = \u003Cspan class=\"hljs-number\">0.9\u003C/span>;\n        } \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> (type === \u003Cspan class=\"hljs-string\">&#x27;files&#x27;\u003C/span> &amp;&amp; text.\u003Cspan class=\"hljs-title function_\">includes\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;.&#x27;\u003C/span>)) {\n            confidence = \u003Cspan class=\"hljs-number\">0.8\u003C/span>;\n        } \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> (type === \u003Cspan class=\"hljs-string\">&#x27;versions&#x27;\u003C/span> &amp;&amp; text.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/\\d+\\.\\d+/\u003C/span>)) {\n            confidence = \u003Cspan class=\"hljs-number\">0.7\u003C/span>;\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-title class_\">Math\u003C/span>.\u003Cspan class=\"hljs-title function_\">min\u003C/span>(confidence, \u003Cspan class=\"hljs-number\">1.0\u003C/span>);\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">deduplicateEntities\u003C/span>(\u003Cspan class=\"hljs-params\">entities\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> seen = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">Map\u003C/span>();\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> entities.\u003Cspan class=\"hljs-title function_\">filter\u003C/span>(\u003Cspan class=\"hljs-function\">\u003Cspan class=\"hljs-params\">entity\u003C/span> =&gt;\u003C/span> {\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> key = \u003Cspan class=\"hljs-string\">`\u003Cspan class=\"hljs-subst\">${entity.text.toLowerCase()}\u003C/span>-\u003Cspan class=\"hljs-subst\">${entity.position}\u003C/span>`\u003C/span>;\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (seen.\u003Cspan class=\"hljs-title function_\">has\u003C/span>(key)) {\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">false\u003C/span>;\n            }\n            seen.\u003Cspan class=\"hljs-title function_\">set\u003C/span>(key, \u003Cspan class=\"hljs-literal\">true\u003C/span>);\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">true\u003C/span>;\n        });\n    }\n}\n\n\u003Cspan class=\"hljs-keyword\">class\u003C/span> \u003Cspan class=\"hljs-title class_\">LinkSuggester\u003C/span> {\n    \u003Cspan class=\"hljs-title function_\">constructor\u003C/span>(\u003Cspan class=\"hljs-params\">knowledgeBase\u003C/span>) {\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">knowledgeBase\u003C/span> = knowledgeBase;\n        \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">linkTemplates\u003C/span> = {\n            \u003Cspan class=\"hljs-attr\">technology\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;https://developer.mozilla.org/en-US/search?q={term}&#x27;\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">github\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;https://github.com/search?q={term}&#x27;\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">npm\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;https://www.npmjs.com/search?q={term}&#x27;\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">pypi\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;https://pypi.org/search/?q={term}&#x27;\u003C/span>,\n            \u003Cspan class=\"hljs-attr\">documentation\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;/docs/search?q={term}&#x27;\u003C/span>\n        };\n    }\n    \n    \u003Cspan class=\"hljs-keyword\">async\u003C/span> \u003Cspan class=\"hljs-title function_\">generateSuggestions\u003C/span>(\u003Cspan class=\"hljs-params\">entities, contentStructure\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">const\u003C/span> suggestions = [];\n        \n        \u003Cspan class=\"hljs-keyword\">for\u003C/span> (\u003Cspan class=\"hljs-keyword\">const\u003C/span> entity \u003Cspan class=\"hljs-keyword\">of\u003C/span> entities) {\n            \u003Cspan class=\"hljs-comment\">// Check knowledge base first\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> knowledgeLink = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">knowledgeBase\u003C/span>.\u003Cspan class=\"hljs-title function_\">get\u003C/span>(entity.\u003Cspan class=\"hljs-property\">text\u003C/span>.\u003Cspan class=\"hljs-title function_\">toLowerCase\u003C/span>());\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (knowledgeLink) {\n                suggestions.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                    ...entity,\n                    \u003Cspan class=\"hljs-attr\">url\u003C/span>: knowledgeLink,\n                    \u003Cspan class=\"hljs-attr\">source\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;knowledge-base&#x27;\u003C/span>,\n                    \u003Cspan class=\"hljs-attr\">confidence\u003C/span>: \u003Cspan class=\"hljs-title class_\">Math\u003C/span>.\u003Cspan class=\"hljs-title function_\">min\u003C/span>(entity.\u003Cspan class=\"hljs-property\">confidence\u003C/span> + \u003Cspan class=\"hljs-number\">0.2\u003C/span>, \u003Cspan class=\"hljs-number\">1.0\u003C/span>)\n                });\n                \u003Cspan class=\"hljs-keyword\">continue\u003C/span>;\n            }\n            \n            \u003Cspan class=\"hljs-comment\">// Generate suggestions based on entity type\u003C/span>\n            \u003Cspan class=\"hljs-keyword\">const\u003C/span> suggestedLink = \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-title function_\">generateLinkByType\u003C/span>(entity, contentStructure);\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> (suggestedLink) {\n                suggestions.\u003Cspan class=\"hljs-title function_\">push\u003C/span>({\n                    ...entity,\n                    \u003Cspan class=\"hljs-attr\">url\u003C/span>: suggestedLink,\n                    \u003Cspan class=\"hljs-attr\">source\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;pattern-match&#x27;\u003C/span>,\n                    \u003Cspan class=\"hljs-attr\">confidence\u003C/span>: entity.\u003Cspan class=\"hljs-property\">confidence\u003C/span>\n                });\n            }\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> suggestions;\n    }\n    \n    \u003Cspan class=\"hljs-title function_\">generateLinkByType\u003C/span>(\u003Cspan class=\"hljs-params\">entity, contentStructure\u003C/span>) {\n        \u003Cspan class=\"hljs-keyword\">switch\u003C/span> (entity.\u003Cspan class=\"hljs-property\">type\u003C/span>) {\n            \u003Cspan class=\"hljs-keyword\">case\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;technology&#x27;\u003C/span>:\n                \u003Cspan class=\"hljs-keyword\">if\u003C/span> (entity.\u003Cspan class=\"hljs-property\">text\u003C/span>.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/JavaScript|JS/i\u003C/span>)) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;https://developer.mozilla.org/en-US/docs/Web/JavaScript&#x27;\u003C/span>;\n                } \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> (entity.\u003Cspan class=\"hljs-property\">text\u003C/span>.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/React/i\u003C/span>)) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;https://reactjs.org/&#x27;\u003C/span>;\n                } \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> (entity.\u003Cspan class=\"hljs-property\">text\u003C/span>.\u003Cspan class=\"hljs-title function_\">match\u003C/span>(\u003Cspan class=\"hljs-regexp\">/Node\\.js/i\u003C/span>)) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;https://nodejs.org/&#x27;\u003C/span>;\n                }\n                \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-variable language_\">this\u003C/span>.\u003Cspan class=\"hljs-property\">linkTemplates\u003C/span>.\u003Cspan class=\"hljs-property\">technology\u003C/span>.\u003Cspan class=\"hljs-title function_\">replace\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;{term}&#x27;\u003C/span>, \u003Cspan class=\"hljs-built_in\">encodeURIComponent\u003C/span>(entity.\u003Cspan class=\"hljs-property\">text\u003C/span>));\n                \n            \u003Cspan class=\"hljs-keyword\">case\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;files&#x27;\u003C/span>:\n                \u003Cspan class=\"hljs-keyword\">const\u003C/span> extension = entity.\u003Cspan class=\"hljs-property\">text\u003C/span>.\u003Cspan class=\"hljs-title function_\">split\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;.&#x27;\u003C/span>).\u003Cspan class=\"hljs-title function_\">pop\u003C/span>().\u003Cspan class=\"hljs-title function_\">toLowerCase\u003C/span>();\n                \u003Cspan class=\"hljs-keyword\">if\u003C/span> ([\u003Cspan class=\"hljs-string\">&#x27;js&#x27;\u003C/span>, \u003Cspan class=\"hljs-string\">&#x27;jsx&#x27;\u003C/span>].\u003Cspan class=\"hljs-title function_\">includes\u003C/span>(extension)) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;https://developer.mozilla.org/en-US/docs/Web/JavaScript&#x27;\u003C/span>;\n                } \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> ([\u003Cspan class=\"hljs-string\">&#x27;py&#x27;\u003C/span>].\u003Cspan class=\"hljs-title function_\">includes\u003C/span>(extension)) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;https://docs.python.org/3/&#x27;\u003C/span>;\n                }\n                \u003Cspan class=\"hljs-keyword\">break\u003C/span>;\n                \n            \u003Cspan class=\"hljs-keyword\">case\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;commands&#x27;\u003C/span>:\n                \u003Cspan class=\"hljs-keyword\">if\u003C/span> (entity.\u003Cspan class=\"hljs-property\">text\u003C/span> === \u003Cspan class=\"hljs-string\">&#x27;git&#x27;\u003C/span>) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;https://git-scm.com/docs&#x27;\u003C/span>;\n                } \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> (entity.\u003Cspan class=\"hljs-property\">text\u003C/span> === \u003Cspan class=\"hljs-string\">&#x27;npm&#x27;\u003C/span>) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;https://docs.npmjs.com/&#x27;\u003C/span>;\n                } \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> (entity.\u003Cspan class=\"hljs-property\">text\u003C/span> === \u003Cspan class=\"hljs-string\">&#x27;docker&#x27;\u003C/span>) {\n                    \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;https://docs.docker.com/&#x27;\u003C/span>;\n                }\n                \u003Cspan class=\"hljs-keyword\">break\u003C/span>;\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">null\u003C/span>;\n    }\n}\n\u003C/code>\u003C/pre>\u003Ch2 id=\"platform-integration-and-compatibility\">Platform Integration and Compatibility\u003C/h2>\n\u003Ch3 id=\"cross-platform-auto-linking-strategies\">Cross-Platform Auto-linking Strategies\u003C/h3>\n\u003Cp>Ensuring consistent auto-linking behavior across different platforms:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Platform Compatibility Matrix\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## GitHub Flavored Markdown\u003C/span>\n\n\u003Cspan class=\"hljs-strong\">**Auto-linking Capabilities:**\u003C/span>\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> ✅ HTTP/HTTPS URLs: https://example.com\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> ✅ Email addresses: user@domain.com  \n\u003Cspan class=\"hljs-bullet\">-\u003C/span> ✅ Issue references: #123\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> ✅ User mentions: @username\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> ✅ Repository links: owner/repository\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> ❌ Phone numbers\n\u003Cspan class=\"hljs-bullet\">-\u003C/span> ❌ Hashtags (outside of issues)\n\n\u003Cspan class=\"hljs-strong\">**Special Behaviors:**\u003C/span>\n\u003Cspan class=\"hljs-code\">```markdown\n&lt;!-- GitHub-specific auto-linking --&gt;\nIssue reference: Fixes #123\nPull request: Related to #456\nUser mention: Thanks @contributor\nRepository reference: See owner/repo for details\nCommit reference: Implemented in abc123def\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"gitlab-flavored-markdown\">GitLab Flavored Markdown\u003C/h2>\n\u003Cp>\u003Cstrong>Auto-linking Capabilities:\u003C/strong>\u003C/p>\n\u003Cul>\n\u003Cli>✅ HTTP/HTTPS URLs: \u003Ca href=\"https://example.com\">https://example.com\u003C/a>\u003C/li>\n\u003Cli>✅ Email addresses: \u003Ca href=\"mailto:user@domain.com\">user@domain.com\u003C/a>\u003C/li>\n\u003Cli>✅ Issue references: #123\u003C/li>\n\u003Cli>✅ Merge request references: !456  \u003C/li>\n\u003Cli>✅ User mentions: @username\u003C/li>\n\u003Cli>✅ Label references: ~&quot;bug&quot;\u003C/li>\n\u003Cli>✅ Milestone references: %milestone\u003C/li>\n\u003C/ul>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">&lt;!-- GitLab-specific patterns --&gt;\nIssue: Closes #123\nMerge request: Related to !456\nUser: Assigned to @developer  \nLabel: Tagged with ~&quot;enhancement&quot;\nMilestone: Target %&quot;v2.0&quot;\n\u003C/code>\u003C/pre>\u003Ch2 id=\"commonmark-standard\">CommonMark Standard\u003C/h2>\n\u003Cp>\u003Cstrong>Auto-linking Capabilities:\u003C/strong>\u003C/p>\n\u003Cul>\n\u003Cli>❌ Bare URL auto-linking\u003C/li>\n\u003Cli>✅ Explicit URL links: \u003Ca href=\"https://example.com\">https://example.com\u003C/a>\u003C/li>\n\u003Cli>✅ Email links: \u003Ca href=\"mailto:user@domain.com\">user@domain.com\u003C/a>\u003C/li>\n\u003Cli>❌ Platform-specific references\u003C/li>\n\u003C/ul>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">&lt;!-- CommonMark explicit linking --&gt;\n\u003Cspan class=\"language-xml\">&lt;https://example.com&gt;\u003C/span>\n\u003Cspan class=\"language-xml\">&lt;user@domain.com&gt;\u003C/span>\n\u003Cspan class=\"language-xml\">&lt;ftp://files.example.com&gt;\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"extended-markdown-processors\">Extended Markdown Processors\u003C/h2>\n\u003Ch3 id=\"kramdown-jekyll\">Kramdown (Jekyll)\u003C/h3>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">&lt;!-- Kramdown extensions --&gt;\nFootnote reference: [^1]\nDefinition reference: term\n: definition\n\nAbbreviation: HTML\n\u003Cspan class=\"hljs-emphasis\">*[HTML]: HyperText Markup Language\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch3 id=\"markdown-it-extensions\">markdown-it Extensions\u003C/h3>\n\u003Cpre>\u003Ccode class=\"hljs language-javascript\">\u003Cspan class=\"hljs-comment\">// Configure markdown-it with auto-linking\u003C/span>\n\u003Cspan class=\"hljs-keyword\">const\u003C/span> \u003Cspan class=\"hljs-title class_\">MarkdownIt\u003C/span> = \u003Cspan class=\"hljs-built_in\">require\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;markdown-it&#x27;\u003C/span>);\n\u003Cspan class=\"hljs-keyword\">const\u003C/span> markdownItLinkify = \u003Cspan class=\"hljs-built_in\">require\u003C/span>(\u003Cspan class=\"hljs-string\">&#x27;markdown-it-linkify&#x27;\u003C/span>);\n\n\u003Cspan class=\"hljs-keyword\">const\u003C/span> md = \u003Cspan class=\"hljs-keyword\">new\u003C/span> \u003Cspan class=\"hljs-title class_\">MarkdownIt\u003C/span>()\n    .\u003Cspan class=\"hljs-title function_\">use\u003C/span>(markdownItLinkify, {\n        \u003Cspan class=\"hljs-attr\">email\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">url\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">fuzzyEmail\u003C/span>: \u003Cspan class=\"hljs-literal\">false\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">fuzzyLink\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>,\n        \u003Cspan class=\"hljs-attr\">fuzzyIP\u003C/span>: \u003Cspan class=\"hljs-literal\">true\u003C/span>\n    });\n\u003C/code>\u003C/pre>\u003Cpre>\u003Ccode>\n### Universal Auto-linking Implementation\n\nCreating platform-agnostic auto-linking solutions:\n\n```javascript\n// universal-autolinker.js - Cross-platform auto-linking\nclass UniversalAutoLinker {\n    constructor(options = {}) {\n        this.platform = options.platform || &#39;generic&#39;;\n        this.options = {\n            baseUrl: options.baseUrl || &#39;&#39;,\n            userUrlTemplate: options.userUrlTemplate || &#39;/users/{username}&#39;,\n            issueUrlTemplate: options.issueUrlTemplate || &#39;/issues/{issue}&#39;,\n            tagUrlTemplate: options.tagUrlTemplate || &#39;/tags/{tag}&#39;,\n            ...options\n        };\n        \n        this.platformConfigs = {\n            github: {\n                autoLinkUrls: true,\n                autoLinkEmails: true,\n                autoLinkIssues: true,\n                autoLinkUsers: true,\n                autoLinkRepos: true,\n                issuePattern: /#(\\d+)/g,\n                userPattern: /@([a-zA-Z0-9_-]+)/g,\n                repoPattern: /([a-zA-Z0-9_.-]+\\/[a-zA-Z0-9_.-]+)/g\n            },\n            gitlab: {\n                autoLinkUrls: true,\n                autoLinkEmails: true,\n                autoLinkIssues: true,\n                autoLinkMergeRequests: true,\n                autoLinkUsers: true,\n                autoLinkLabels: true,\n                autoLinkMilestones: true,\n                issuePattern: /#(\\d+)/g,\n                mergeRequestPattern: /!(\\d+)/g,\n                userPattern: /@([a-zA-Z0-9_-]+)/g,\n                labelPattern: /~&quot;([^&quot;]+)&quot;/g,\n                milestonePattern: /%&quot;([^&quot;]+)&quot;/g\n            },\n            generic: {\n                autoLinkUrls: true,\n                autoLinkEmails: true,\n                autoLinkPhones: false,\n                autoLinkHashtags: false,\n                autoLinkMentions: false\n            }\n        };\n        \n        this.currentConfig = this.platformConfigs[this.platform] || this.platformConfigs.generic;\n    }\n    \n    processContent(content) {\n        let processedContent = content;\n        \n        // Skip if already processed or in code blocks\n        if (this.shouldSkipProcessing(content)) {\n            return content;\n        }\n        \n        // Apply platform-specific processing\n        if (this.currentConfig.autoLinkUrls) {\n            processedContent = this.processUrls(processedContent);\n        }\n        \n        if (this.currentConfig.autoLinkEmails) {\n            processedContent = this.processEmails(processedContent);\n        }\n        \n        if (this.currentConfig.autoLinkIssues &amp;&amp; this.currentConfig.issuePattern) {\n            processedContent = this.processIssues(processedContent);\n        }\n        \n        if (this.currentConfig.autoLinkUsers &amp;&amp; this.currentConfig.userPattern) {\n            processedContent = this.processUsers(processedContent);\n        }\n        \n        if (this.currentConfig.autoLinkRepos &amp;&amp; this.currentConfig.repoPattern) {\n            processedContent = this.processRepositories(processedContent);\n        }\n        \n        // GitLab-specific processing\n        if (this.platform === &#39;gitlab&#39;) {\n            if (this.currentConfig.autoLinkMergeRequests) {\n                processedContent = this.processMergeRequests(processedContent);\n            }\n            \n            if (this.currentConfig.autoLinkLabels) {\n                processedContent = this.processLabels(processedContent);\n            }\n            \n            if (this.currentConfig.autoLinkMilestones) {\n                processedContent = this.processMilestones(processedContent);\n            }\n        }\n        \n        return processedContent;\n    }\n    \n    shouldSkipProcessing(content) {\n        // Skip if content has auto-linking markers\n        if (content.includes(&#39;&lt;!-- no-autolink --&gt;&#39;)) {\n            return true;\n        }\n        \n        // Skip code blocks and inline code\n        const codeBlockPattern = /```[\\s\\S]*?```|`[^`]+`/g;\n        return codeBlockPattern.test(content);\n    }\n    \n    processUrls(content) {\n        const urlPattern = /https?:\\/\\/(?:[-\\w.])+(?::[0-9]+)?(?:\\/(?:[\\w\\/_.])*)?(?:\\?(?:[\\w&amp;=%.])*)?(?:#(?:[\\w.])*)?/g;\n        \n        return content.replace(urlPattern, (match) =&gt; {\n            if (this.isAlreadyLinked(content, match)) {\n                return match;\n            }\n            \n            return `[${match}](${match})`;\n        });\n    }\n    \n    processEmails(content) {\n        const emailPattern = /\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b/g;\n        \n        return content.replace(emailPattern, (match) =&gt; {\n            if (this.isAlreadyLinked(content, match)) {\n                return match;\n            }\n            \n            return `[${match}](mailto:${match})`;\n        });\n    }\n    \n    processIssues(content) {\n        return content.replace(this.currentConfig.issuePattern, (match, issueNumber) =&gt; {\n            if (this.isAlreadyLinked(content, match)) {\n                return match;\n            }\n            \n            const issueUrl = this.buildIssueUrl(issueNumber);\n            return `[${match}](${issueUrl})`;\n        });\n    }\n    \n    processUsers(content) {\n        return content.replace(this.currentConfig.userPattern, (match, username) =&gt; {\n            if (this.isAlreadyLinked(content, match)) {\n                return match;\n            }\n            \n            const userUrl = this.buildUserUrl(username);\n            return `[${match}](${userUrl})`;\n        });\n    }\n    \n    processRepositories(content) {\n        return content.replace(this.currentConfig.repoPattern, (match) =&gt; {\n            if (this.isAlreadyLinked(content, match)) {\n                return match;\n            }\n            \n            const repoUrl = this.buildRepositoryUrl(match);\n            return `[${match}](${repoUrl})`;\n        });\n    }\n    \n    processMergeRequests(content) {\n        return content.replace(this.currentConfig.mergeRequestPattern, (match, mrNumber) =&gt; {\n            if (this.isAlreadyLinked(content, match)) {\n                return match;\n            }\n            \n            const mrUrl = this.buildMergeRequestUrl(mrNumber);\n            return `[${match}](${mrUrl})`;\n        });\n    }\n    \n    processLabels(content) {\n        return content.replace(this.currentConfig.labelPattern, (match, label) =&gt; {\n            if (this.isAlreadyLinked(content, match)) {\n                return match;\n            }\n            \n            const labelUrl = this.buildLabelUrl(label);\n            return `[${match}](${labelUrl})`;\n        });\n    }\n    \n    processMilestones(content) {\n        return content.replace(this.currentConfig.milestonePattern, (match, milestone) =&gt; {\n            if (this.isAlreadyLinked(content, match)) {\n                return match;\n            }\n            \n            const milestoneUrl = this.buildMilestoneUrl(milestone);\n            return `[${match}](${milestoneUrl})`;\n        });\n    }\n    \n    buildIssueUrl(issueNumber) {\n        return this.options.issueUrlTemplate.replace(&#39;{issue}&#39;, issueNumber);\n    }\n    \n    buildUserUrl(username) {\n        return this.options.userUrlTemplate.replace(&#39;{username}&#39;, username);\n    }\n    \n    buildRepositoryUrl(repo) {\n        return `/${repo}`;\n    }\n    \n    buildMergeRequestUrl(mrNumber) {\n        return `/merge_requests/${mrNumber}`;\n    }\n    \n    buildLabelUrl(label) {\n        return this.options.tagUrlTemplate.replace(&#39;{tag}&#39;, encodeURIComponent(label));\n    }\n    \n    buildMilestoneUrl(milestone) {\n        return `/milestones/${encodeURIComponent(milestone)}`;\n    }\n    \n    isAlreadyLinked(content, text) {\n        const beforeIndex = content.indexOf(text);\n        if (beforeIndex === -1) return false;\n        \n        const beforeText = content.substring(Math.max(0, beforeIndex - 10), beforeIndex);\n        const afterIndex = beforeIndex + text.length;\n        const afterText = content.substring(afterIndex, Math.min(content.length, afterIndex + 10));\n        \n        // Check for markdown link syntax\n        return beforeText.includes(&#39;[&#39;) &amp;&amp; afterText.includes(&#39;](&#39;);\n    }\n}\n\nmodule.exports = UniversalAutoLinker;\n\u003C/code>\u003C/pre>\u003Ch2 id=\"integration-with-content-management-systems\">Integration with Content Management Systems\u003C/h2>\n\u003Cp>Auto-linking systems integrate seamlessly with modern content management workflows. When combined with \u003Ca href=\"/blog/markdown-automation-workflows-complete-guide\">automated documentation workflows and CI/CD systems\u003C/a>, auto-linking becomes part of the content processing pipeline, ensuring that URLs and references are automatically converted to proper links during the build and deployment process.\u003C/p>\n\u003Cp>For sophisticated content architectures, auto-linking works effectively with \u003Ca href=\"/blog/markdown-table-sorting-filtering-interactive-guide\">advanced table systems and data presentation\u003C/a> to create dynamic content where data references automatically become navigable links, enhancing user experience and content discoverability.\u003C/p>\n\u003Cp>When building comprehensive documentation platforms, auto-linking complements \u003Ca href=\"/blog/markdown-progressive-web-app-documentation-complete-guide\">Progressive Web App functionality and offline capabilities\u003C/a> by ensuring that automatically generated links work correctly in offline scenarios and maintain consistent behavior across different browsing contexts and application states.\u003C/p>\n\u003Ch2 id=\"troubleshooting-auto-linking-issues\">Troubleshooting Auto-linking Issues\u003C/h2>\n\u003Ch3 id=\"common-auto-linking-problems\">Common Auto-linking Problems\u003C/h3>\n\u003Cp>\u003Cstrong>Problem\u003C/strong>: URLs not being auto-linked in certain contexts\u003C/p>\n\u003Cp>\u003Cstrong>Solutions\u003C/strong>:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Auto-linking Troubleshooting Guide\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Problem 1: URLs in Code Blocks\u003C/span>\n\nWrong approach:\n\u003C/code>\u003C/pre>\u003Cp>Check out \u003Ca href=\"https://example.com\">https://example.com\u003C/a> for more info\u003C/p>\n\u003Cpre>\u003Ccode>\nCorrect approach - URLs in code should remain as-is:\n```text\nCheck out https://example.com for more info  \n\u003C/code>\u003C/pre>\u003Ch2 id=\"problem-2-conflicting-link-syntax\">Problem 2: Conflicting Link Syntax\u003C/h2>\n\u003Cp>Wrong - double linking:\u003Cbr>[Check out \u003Ca href=\"https://example.com\">https://example.com\u003C/a>]\u003C/p>\n\u003Cp>Correct - choose one approach:\u003Cbr>Check out \u003Ca href=\"https://example.com\">the website\u003C/a>\u003Cbr>OR\u003Cbr>Check out \u003Ca href=\"https://example.com\">https://example.com\u003C/a>\u003C/p>\n\u003Ch2 id=\"problem-3-special-characters-in-urls\">Problem 3: Special Characters in URLs\u003C/h2>\n\u003Cp>Problematic:\u003Cbr>\u003Ca href=\"https://example.com/search?q=%22test\">https://example.com/search?q=&quot;test\u003C/a> query&quot;&amp;type=advanced\u003C/p>\n\u003Cp>Better - encode special characters:\u003Cbr>\u003Ca href=\"https://example.com/search?q=%22test%20query%22&type=advanced\">https://example.com/search?q=%22test%20query%22&amp;type=advanced\u003C/a>\u003C/p>\n\u003Ch2 id=\"problem-4-performance-issues\">Problem 4: Performance Issues\u003C/h2>\n\u003Cp>Large documents with many URLs can slow processing:\u003C/p>\n\u003Cul>\n\u003Cli>Use caching for URL validation\u003C/li>\n\u003Cli>Process content in chunks\u003C/li>\n\u003Cli>Implement rate limiting for external validation\u003C/li>\n\u003Cli>Cache successful validations\u003C/li>\n\u003C/ul>\n\u003Cpre>\u003Ccode>\n### Debug Mode for Auto-linking\n\n```javascript\n// debug-autolinker.js - Debug auto-linking issues\nclass AutoLinkDebugger {\n    constructor(autoLinker) {\n        this.autoLinker = autoLinker;\n        this.debugMode = true;\n        this.debugLog = [];\n    }\n    \n    debugProcessContent(content) {\n        this.debugLog = [];\n        this.log(&#39;Starting auto-link processing&#39;);\n        \n        const originalContent = content;\n        const processedContent = this.autoLinker.processContent(content);\n        \n        // Compare original and processed content\n        const changes = this.findChanges(originalContent, processedContent);\n        this.log(`Found ${changes.length} auto-link changes`);\n        \n        changes.forEach((change, index) =&gt; {\n            this.log(`Change ${index + 1}: ${change.original} -&gt; ${change.processed}`);\n        });\n        \n        return {\n            content: processedContent,\n            debugLog: this.debugLog,\n            changes: changes\n        };\n    }\n    \n    findChanges(original, processed) {\n        const changes = [];\n        \n        // Simple diff to find what was changed\n        if (original !== processed) {\n            const originalLines = original.split(&#39;\\n&#39;);\n            const processedLines = processed.split(&#39;\\n&#39;);\n            \n            originalLines.forEach((originalLine, index) =&gt; {\n                const processedLine = processedLines[index] || &#39;&#39;;\n                if (originalLine !== processedLine) {\n                    changes.push({\n                        line: index + 1,\n                        original: originalLine,\n                        processed: processedLine\n                    });\n                }\n            });\n        }\n        \n        return changes;\n    }\n    \n    log(message) {\n        if (this.debugMode) {\n            const timestamp = new Date().toISOString();\n            this.debugLog.push(`[${timestamp}] ${message}`);\n            console.log(`[AutoLink Debug] ${message}`);\n        }\n    }\n    \n    analyzeFailures(content) {\n        const analysis = {\n            potentialUrls: [],\n            potentialEmails: [],\n            blockedByCodeBlocks: [],\n            alreadyLinked: []\n        };\n        \n        // Find potential URLs that weren&#39;t auto-linked\n        const urlPattern = /https?:\\/\\/[^\\s]+/g;\n        let match;\n        \n        while ((match = urlPattern.exec(content)) !== null) {\n            const url = match[0];\n            const context = this.getContext(content, match.index, url.length);\n            \n            if (this.isInCodeBlock(content, match.index)) {\n                analysis.blockedByCodeBlocks.push({ url, context });\n            } else if (this.isAlreadyLinked(content, match.index, url.length)) {\n                analysis.alreadyLinked.push({ url, context });\n            } else {\n                analysis.potentialUrls.push({ url, context });\n            }\n        }\n        \n        return analysis;\n    }\n    \n    getContext(content, start, length, contextSize = 30) {\n        const before = content.substring(\n            Math.max(0, start - contextSize), \n            start\n        );\n        const after = content.substring(\n            start + length,\n            Math.min(content.length, start + length + contextSize)\n        );\n        \n        return { before, after };\n    }\n    \n    isInCodeBlock(content, position) {\n        const beforeContent = content.substring(0, position);\n        const codeBlockStarts = (beforeContent.match(/```/g) || []).length;\n        return codeBlockStarts % 2 === 1; // Odd number means inside code block\n    }\n    \n    isAlreadyLinked(content, start, length) {\n        const beforeChar = content.charAt(start - 1);\n        const afterChar = content.charAt(start + length);\n        \n        // Simple check for markdown link syntax\n        return beforeChar === &#39;(&#39; &amp;&amp; content.charAt(start + length + 1) === &#39;)&#39;;\n    }\n}\n\u003C/code>\u003C/pre>\u003Ch2 id=\"conclusion\">Conclusion\u003C/h2>\n\u003Cp>Advanced Markdown auto-linking and URL detection capabilities represent a powerful approach to content creation that balances automation with control, enabling efficient workflows while maintaining precise formatting and user experience standards. By implementing sophisticated URL recognition patterns, understanding platform-specific behaviors, and creating intelligent link generation systems, content creators can build automated workflows that significantly reduce manual link management while ensuring consistent, high-quality link formatting across large content repositories.\u003C/p>\n\u003Cp>The key to successful auto-linking implementation lies in understanding the specific requirements of your target platforms, implementing robust pattern recognition systems, and maintaining careful balance between automated convenience and editorial control. Whether you&#39;re building technical documentation, content management systems, or collaborative writing platforms, the techniques covered in this guide provide the foundation for creating efficient, maintainable auto-linking systems that serve both content creators and end users effectively.\u003C/p>\n\u003Cp>Remember to test auto-linking behaviors across your target platforms, implement debugging and monitoring systems to catch edge cases, and continuously refine your URL recognition patterns based on real-world content patterns. With proper implementation of advanced auto-linking systems, your Markdown-based content can deliver seamless user experiences that automatically transform plain text into rich, navigable documents while preserving the simplicity and maintainability that makes Markdown such an effective content creation format.\u003C/p>\n",[15,19,22,25,28,31,34,37,40,43,46,49,52],{"id":16,"text":17,"level":18},"why-master-markdown-auto-linking-and-url-detection","Why Master Markdown Auto-linking and URL Detection?",2,{"id":20,"text":21,"level":18},"foundation-auto-linking-behaviors","Foundation Auto-linking Behaviors",{"id":23,"text":24,"level":18},"advanced-url-recognition-patterns","Advanced URL Recognition Patterns",{"id":26,"text":27,"level":18},"platform-integration-and-compatibility","Platform Integration and Compatibility",{"id":29,"text":30,"level":18},"gitlab-flavored-markdown","GitLab Flavored Markdown",{"id":32,"text":33,"level":18},"commonmark-standard","CommonMark Standard",{"id":35,"text":36,"level":18},"extended-markdown-processors","Extended Markdown Processors",{"id":38,"text":39,"level":18},"integration-with-content-management-systems","Integration with Content Management Systems",{"id":41,"text":42,"level":18},"troubleshooting-auto-linking-issues","Troubleshooting Auto-linking Issues",{"id":44,"text":45,"level":18},"problem-2-conflicting-link-syntax","Problem 2: Conflicting Link Syntax",{"id":47,"text":48,"level":18},"problem-3-special-characters-in-urls","Problem 3: Special Characters in URLs",{"id":50,"text":51,"level":18},"problem-4-performance-issues","Problem 4: Performance Issues",{"id":53,"text":54,"level":18},"conclusion","Conclusion",[],[57,65,73],{"slug":58,"title":59,"description":60,"excerpt":61,"date":62,"category":9,"author":10,"keywords":63,"readingMinutes":64},"markdown-diagram-workflows-integration-complete-guide","Markdown Diagram Workflows and Integration: Complete Guide for Visual Documentation and Automated Diagram Generation","Master advanced Markdown diagram workflows with Mermaid, PlantUML, and D2. Learn automated diagram generation, version control integration, CI/CD pipelines, and cross-platform compatibility for professional visual documentation.","Advanced Markdown diagram workflows and integration techniques enable sophisticated visual documentation that combines the simplicity of text-based markup with powerful automated diagram…","2025-11-03","markdown diagrams, mermaid diagrams, plantuml markdown, d2 diagrams, diagram automation, visual documentation, markdown workflows, diagram version control, automated diagrams",16,{"slug":66,"title":67,"description":68,"excerpt":69,"date":70,"category":9,"author":10,"keywords":71,"readingMinutes":72},"markdown-dynamic-content-generation-complete-guide","Markdown Dynamic Content Generation: Complete Guide for Automated Documentation and Data-Driven Content Creation","Master dynamic Markdown content generation with templating systems, data binding, automated documentation generation, and programmatic content creation. Learn to build scalable, maintainable documentation workflows that generate content from data sources automatically.","Dynamic Markdown content generation transforms static documentation workflows into powerful, data-driven systems that automatically create, update, and maintain content based on external data…","2025-10-13","markdown dynamic content, markdown templates, automated documentation generation, data-driven markdown, markdown templating systems, programmatic content creation, dynamic documentation workflows, markdown automation",33,{"slug":74,"title":75,"description":76,"excerpt":77,"date":78,"category":9,"author":10,"keywords":79,"readingMinutes":80},"markdown-linting-quality-assurance-complete-guide","Markdown Linting and Quality Assurance: Complete Guide for Automated Error Detection, Style Enforcement, and Documentation Standards","Master Markdown linting and quality assurance with comprehensive error detection tools, automated style enforcement, documentation standards, and continuous integration workflows for professional technical writing.","Markdown linting and quality assurance systems provide systematic error detection, style enforcement, and documentation standards that ensure consistent, professional, and maintainable technical…","2025-12-23","markdown linting, markdown quality assurance, markdownlint, markdown style guide, automated markdown validation, markdown CI/CD, documentation standards, markdown error detection",8,1792184942848]