Ever paste a Pickaxe response into an email, document, CRM, or text editor and bring along a bunch of unwanted formatting?
This custom script forces copied content to use clean, plain text. It removes HTML and common Markdown formatting while preserving the actual written content and readable line breaks.
What it removes
- Bold, italics, strikethrough, and inline code formatting
- Markdown headings and blockquotes
- Link URLs while keeping the visible link text
- Image URLs while keeping the image description
- HTML tags and excessive whitespace
It only changes what is placed on the clipboard. It does not change how responses appear inside your Pickaxe.
How to install it
- Open your Pickaxe’s settings.
- Go to Custom Scripts (also shown as Website Code Injection in some Studio views).
- Paste the script below into the Body field.
- Save and publish your changes.
- Reload the page before testing it.
<script>
(() => {
if (window.__pickaxePlainTextCopyInstalled) return;
window.__pickaxePlainTextCopyInstalled = true;
const sanitizeCopiedText = (value) => {
let text = String(value || "").replace(/\u00a0/g, " ");
if (/<\/?[a-z][\s\S]*?>/i.test(text)) {
const parsed = new DOMParser().parseFromString(text, "text/html");
parsed.body.querySelectorAll("br").forEach((element) => element.replaceWith("\n"));
parsed.body
.querySelectorAll("p, div, li, blockquote, h1, h2, h3, h4, h5, h6")
.forEach((element) => element.append("\n"));
text = parsed.body.textContent || "";
}
return text
.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1")
.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
.replace(/^\s{0,3}#{1,6}\s+/gm, "")
.replace(/^\s*>\s?/gm, "")
.replace(/^\s*(?:\*{2,}|_{2,}|~{2,})\s*$/gm, "")
.replace(/\*\*([^*\n]+)\*\*/g, "$1")
.replace(/__([^_\n]+)__/g, "$1")
.replace(/~~([^~\n]+)~~/g, "$1")
.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g, "$1$2")
.replace(/(^|[^_])_([^_\n]+)_(?!_)/g, "$1$2")
.replace(/`([^`\n]+)`/g, "$1")
.replace(/\\([\\`*_[\]{}()#+\-.!>])/g, "$1")
.replace(/[ \t]+$/gm, "")
.replace(/\n{3,}/g, "\n\n")
.trim();
};
const clipboard = navigator.clipboard;
if (clipboard && typeof clipboard.write === "function" && typeof clipboard.writeText === "function") {
const nativeWrite = clipboard.write.bind(clipboard);
const nativeWriteText = clipboard.writeText.bind(clipboard);
const htmlToPlainText = (html) => {
const parsed = new DOMParser().parseFromString(html, "text/html");
return sanitizeCopiedText(parsed.body.innerText || parsed.body.textContent || "");
};
const writePlainTextOnly = async (items) => {
for (const item of Array.from(items || [])) {
const types = Array.from(item?.types || []);
if (types.includes("text/plain")) {
const plainBlob = await item.getType("text/plain");
return nativeWriteText(sanitizeCopiedText(await plainBlob.text()));
}
if (types.includes("text/html")) {
const htmlBlob = await item.getType("text/html");
return nativeWriteText(htmlToPlainText(await htmlBlob.text()));
}
}
return nativeWrite(items);
};
try {
Object.defineProperty(clipboard, "write", {
configurable: true,
value: writePlainTextOnly,
});
} catch {
const clipboardPrototype = Object.getPrototypeOf(clipboard);
if (clipboardPrototype) {
Object.defineProperty(clipboardPrototype, "write", {
configurable: true,
value: writePlainTextOnly,
});
}
}
}
window.addEventListener("copy", (event) => {
if (!event.clipboardData) return;
const text = event.clipboardData.getData("text/plain") || window.getSelection()?.toString();
if (!text) return;
event.preventDefault();
event.clipboardData.clearData();
event.clipboardData.setData("text/plain", sanitizeCopiedText(text));
});
})();
</script>
Where it works
This has been tested on:
- Direct Pickaxe links
- Portal pages
It may also work inside embedded Pickaxes, although embed behavior can vary depending on the website, browser permissions, and iframe configuration.
Once installed, try copying a formatted response and pasting it into a plain text field. You should get clean text without the extra styling.
Hopefully this saves a few people from constantly reaching for “Paste and Match Style”!