User:CWenger/emDashesFunction.js

function autoEdEmDashes(str) { str = str.replace(/( | )?—( | )?/g, '—'); return str; }