// Name: Unescape Newlines in Selection // Description: Replace literal "\n" sequences in the current selection with actual newline characters. // Author: dallascrilley // GitHub: dallascrilley import "@johnlindquist/kit" const selected = await getSelectedText() if (!selected) { await beep() exit() } const matches = selected.match(/\\n/g) || [] if (matches.length === 0) { await beep() exit() } const replaced = selected.replace(/\\n/g, "\n") await setSelectedText(replaced) await toast(`Replaced ${matches.length} \\n ${matches.length === 1 ? "sequence" : "sequences"}`)