Skip to content

Instantly share code, notes, and snippets.

@normalhuman
Created September 24, 2016 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save normalhuman/c6b72d73217be0bcc414aa296f32f5c2 to your computer and use it in GitHub Desktop.
Save normalhuman/c6b72d73217be0bcc414aa296f32f5c2 to your computer and use it in GitHub Desktop.
spelling.js
b=document.querySelector('.wmd-input.processed');
if (b) {
a=b.value;
a=a.replace(/\bi(?=\s|\')/g,'I');
a=a.replace(/\b[Ii]m\b/g,'I\'m');
a=a.replace(/\b[Ii]ve\b/g,'I\'ve');
a=a.replace(/\b(ca|did|do|does|has|is|was|were|wo)nt\b/gi,'$1n\'t');
a=a.replace(/\b(w|t)hats\b/gi,'$1hat\'s');
a=a.replace(/\b(c|w|sh)ouldnt\b/gi,'$1ouldn\'t');
a=a.replace(/\b(t)heres\b/gi,'$1here\'s');
a=a.replace(/\bjavascript\b/gi,'JavaScript');
a=a.replace(/(\w)[ ]+(\.|;|,|\?|!)/g,'$1$2');
b.value=a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment