Skip to content

Instantly share code, notes, and snippets.

@SteGriff
Last active July 16, 2026 10:28
Show Gist options
  • Select an option

  • Save SteGriff/4651d5ef26c1d6e3b5127085aaa18195 to your computer and use it in GitHub Desktop.

Select an option

Save SteGriff/4651d5ef26c1d6e3b5127085aaa18195 to your computer and use it in GitHub Desktop.
Unsmart.htm
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Unsmart</title>
<style>
* { box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
margin: 1rem;
}
textarea {
width: 100%;
height: 10rem;
margin-bottom: 1rem;
font-family: Consolas, monospace;
padding: 1rem;
}
button {
padding: 1rem 2rem;
cursor: pointer;
}
h1 { font-size: 1.5rem; }
</style>
</head>
<body>
<h1>Unsmart</h1>
<label for="inputText">Input:</label>
<textarea id="inputText" placeholder="Paste text with smart quotes or em dashes here..."></textarea>
<button onclick="cleanText()">Clean Text</button>
<label for="outputText">Output:</label>
<textarea id="outputText" placeholder="Cleaned text will appear here..."></textarea>
<script>
function cleanText() {
let text = document.getElementById("inputText").value;
// Replace smart double quotes
text = text.replace(/[\u201C\u201D]/g, '"');
// Replace smart single quotes / apostrophes
text = text.replace(/[\u2018\u2019]/g, "'");
// Replace em dashes
text = text.replace(/\u2014/g, "-");
document.getElementById("outputText").value = text;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment