Command line interface for Textr
It can compose any functions that transforms text using Textr. For example, check out few: typographic-quotes, typographic-math-symbols, typographic-em-dashes and typographic-ellipses.
Install textr
globaly:
npm install -g textr-cli
After install, you can use textr
command for processing your text files, like this:
# load from file, transformers required through few -t flags
$ textr foo.md -t typographic-quotes -t typographic-quotes
# load from file, transformers required through one -t
$ textr foo.md -t typographic-single-spaces,typographic-quotes
# load through stdin, iso-locale equals ru, transformers using --transforms
$ cat foo.md | textr -l ru --transforms=typographic-single-spaces
# load through stdin, write result into file
$ cat foo.md | textr -o bar.md
You can use textr
with specified options:
-
-t
,--transforms
— array of transformers, which will be applied (transformers should be installed globaly or localy in current project); -
-o
,--out-file
— write output to file; -
-l
,--locale
— ISO 639 locale codes (en-us
as default); -
-w
,--watch
— Watch changes in source file (works only with input as first argument and output through-o
or--out-file
flags); -
-h
,--help
— show help message.
For example, you have a markdown article with some typographic mistakes, like a three periods instead of ellipsis character or whatever else. Thanks for textr-cli you can easily fix this. Just run textr
with transformers which you need and get corrected text:
$ cat foo.md
Hello, "world"...
Yet "another" string
Yet... one…
$ textr foo.md -t typographic-single-spaces,typographic-quotes,typographic-ellipses
Hello, “world”…
Yet “another” string
Yet… one…
Typography for everybody!
MIT © Denys Dovhan