Skip to content

Instantly share code, notes, and snippets.

@re-gor
Created November 10, 2020 17:06
Show Gist options
  • Save re-gor/e03b3a92eae91572a3fae09b22c1ba7a to your computer and use it in GitHub Desktop.
Save re-gor/e03b3a92eae91572a3fae09b22c1ba7a to your computer and use it in GitHub Desktop.
Типограф для webstorm
npm i typograf
node ./index.js Рама - раме по раме
const Typograf = require('typograf');
const inputText = Array.from(process.argv).slice(2).join(' ');
const typograf = new Typograf({locale: ['ru', 'en-US'], htmlEntity: {type: 'name', onlyInvisible: true}});
const processedText = typograf.execute(inputText);
pbcopy(processedText.replace(/ /g, '\\u00A0'));
function pbcopy(data) {
var proc = require('child_process').spawn('pbcopy');
proc.stdin.write(data);
proc.stdin.end();
}
@Katysheva
Copy link

Данный скрипт работает только для мака? Под виндой не завёлся

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment