Links recognition library with FULL unicode support for detecting high-quality link patterns in plain text
Overall
score
97%
Create a utility that detects and highlights URLs in plain text content, even when they don't include a protocol prefix (like http:// or https://).
Your utility should:
Detect URLs in text that may or may not have a protocol prefix
https://example.comexample.com or www.subdomain.example.org//example.comFor each detected URL in the text, return information about:
Support configuration to enable or disable detection of URLs without protocol prefixes
Provide a quick check function to determine if text potentially contains any URLs before performing full detection
Given the text "Check out example.com for more info", it detects the URL example.com starting at index 10 @test
Given the text "Visit www.github.com/repo today", it detects www.github.com/repo and normalizes it to include a protocol @test
Given the text "The site //cdn.example.org is fast", it detects the protocol-neutral URL //cdn.example.org @test
When fuzzy link detection is disabled, the text "Go to example.com" should not detect any URLs @test
@generates
/**
* Creates a URL detector with optional configuration
* @param {Object} options - Configuration options
* @param {boolean} options.fuzzyLink - Enable detection of URLs without protocol (default: true)
* @returns {Object} URL detector instance
*/
function createDetector(options) {
// IMPLEMENTATION HERE
}
/**
* Checks if text contains any potential URLs
* @param {string} text - Text to check
* @returns {boolean} True if text might contain URLs
*/
function hasUrls(text) {
// IMPLEMENTATION HERE
}
/**
* Finds all URLs in the given text
* @param {string} text - Text to search
* @returns {Array|null} Array of match objects with index, lastIndex, raw, text, url properties, or null if none found
*/
function findUrls(text) {
// IMPLEMENTATION HERE
}
module.exports = {
createDetector,
hasUrls,
findUrls,
};Provides link detection and recognition capabilities with full Unicode support.
Install with Tessl CLI
npx tessl i tessl/npm-linkify-itdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10