Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gromnitsky/fmt-hyphen

A text formatter akin to fmt(1) but with hyphenation support
https://github.com/gromnitsky/fmt-hyphen

Last synced: about 6 hours ago
JSON representation

A text formatter akin to fmt(1) but with hyphenation support

Awesome Lists containing this project

README

        

# fmt-hyphen

A text formatter akin to [fmt(1)][] but with hyphenation support. Can
output images as well. Folds long words as a last resort only.

[fmt(1)]: https://manpages.debian.org/unstable/coreutils/fmt.1.en.html

$ head -200 moby-dick.txt | fmt-hyphen -w30 --image 1.png

produces a long, narrow .png (this is a preview in
com.google.android.apps.photos):

Could be used to share hot takes on twitter w/o using twitter
"threads". Also, I had nothing to do in the last days of 2020.

## Installation

$ npm i -g fmt-hyphen

Tested on node 15.5.0, f33.

## Usage

~~~
$ head -10 moby-dick.txt | ./fmt-hyphen -w30
MOBY-DICK; or, THE WHALE.

By Herman Melville

CHAPTER 1. Loomings.

Call me Ishmael. Some years
ago—never mind how long pre‐
cisely—having little or no
money in my purse, and nothing
particular to interest me on
shore, I thought I would sail
about a little and see the wa‐
tery part of the world. It is
a way I have of driving off
the spleen and
~~~

Print supported language patterns (`-l` option to select):

~~~
$ ./fmt-hyphen --lang-list | column
be en-us hy nl ta
bn es it or te
ca fi kn pa tr
cs fr la pl uk
da grc lt pt
de gu lv sk
el-monoton hi ml sl
el-polyton hu nb-no sv
~~~

## License

MIT