Files
Andrei 58f8093689 Rebrand from 'Redirect Intelligence v2' to 'URL Tracker Tool V2' throughout UI
- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
2025-08-19 19:12:23 +00:00

43 lines
1.1 KiB
JavaScript

import {decodeNamedCharacterReference} from 'decode-named-character-reference'
import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'
const characterEscapeOrReference =
/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi
/**
* Decode markdown strings (which occur in places such as fenced code info
* strings, destinations, labels, and titles).
*
* The “string” content type allows character escapes and -references.
* This decodes those.
*
* @param {string} value
* Value to decode.
* @returns {string}
* Decoded value.
*/
export function decodeString(value) {
return value.replace(characterEscapeOrReference, decode)
}
/**
* @param {string} $0
* @param {string} $1
* @param {string} $2
* @returns {string}
*/
function decode($0, $1, $2) {
if ($1) {
// Escape.
return $1
}
// Reference.
const head = $2.charCodeAt(0)
if (head === 35) {
const head = $2.charCodeAt(1)
const hex = head === 120 || head === 88
return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10)
}
return decodeNamedCharacterReference($2) || $0
}