Overview
What HTML Unescape does
Decodes common typographic and currency entities plus decimal or hexadecimal Unicode references, while leaving unknown or invalid entities unchanged.
| Category | Developer Tools |
|---|---|
| Action type | JavaScript |
| Result | Replace or copy text |
| Internet | Not required |
Example
Action and outcome
| Action | Outcome |
|---|---|
| HTML UnescapeSelected text: <p>Ready & waiting 👋</p> | <p>Ready & waiting 👋</p> |
Workflow
Use HTML Unescape
Follow these steps to decode common named and numeric HTML entities with ActionClip.
- Select the text you want to use.
- Choose HTML Unescape from ActionClip.
- Review the result, then replace the selection or copy the new text.
Before you add it
Requirements and privacy
- Before you start: No setup required.
- Your selected text: Runs locally in ActionClip’s JavaScript sandbox. Selected text does not leave your Mac.
Inspect before installing
Action configuration
The definition below is included so you can inspect how the action works before downloading it.
JavaScript definition
function run(selected_text) {
const named = {
amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", nbsp: "\u00A0",
ndash: "–", mdash: "—", hellip: "…", copy: "©", reg: "®", trade: "™",
euro: "€", pound: "£", yen: "¥", cent: "¢", laquo: "«", raquo: "»",
lsquo: "‘", rsquo: "’", ldquo: "“", rdquo: "”", bull: "•", middot: "·",
times: "×", divide: "÷"
};
return selected_text.replace(/&(#(?:x[0-9a-f]+|\d+)|[a-z][a-z0-9]+);/gi, (match, entity) => {
if (entity[0] !== "#") return named[entity.toLowerCase()] ?? match;
const isHex = entity[1].toLowerCase() === "x";
const value = parseInt(entity.slice(isHex ? 2 : 1), isHex ? 16 : 10);
if (!Number.isFinite(value) || value < 0 || value > 0x10FFFF || (value >= 0xD800 && value <= 0xDFFF)) {
return match;
}
return String.fromCodePoint(value);
});
}