I'm looking for a better way to wrap lines. I have Markdown Hugo source to my website and haven't been wrapping the lines for a while. One of the problems I ran into was things like lists getting messed up if I formatted with
For example:
Becomes:
I'd like to keep the 1, 2, 3, all on separate lines but wrap the first line (as it does) and leave the last line alone (as it also does).
So effectively, only splitting a line if it's longer than the maximum.
On FreeBSD, -s is a whitespace collapsing argument. If -s wasn't used on FreeBSD, I'd be tempted to rewrite the feature and just use -s. I could still do it with a different argument name, although not certain which one.
Is there another utility which does this? Maybe something in Ports? If I did write a patch for FreeBSD's
Thank you for your time.
fmt
.For example:
Code:
please wrap this really long set of words. one two, three, four, five; six, seven, eight
1. don't
2. wrap
3. this
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Becomes:
Code:
please wrap this really long set of words. one two, three, four,
five; six, seven, eight
1. don't 2. wrap 3. this
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
I'd like to keep the 1, 2, 3, all on separate lines but wrap the first line (as it does) and leave the last line alone (as it also does).
So effectively, only splitting a line if it's longer than the maximum.
fold
does this, but it's a hard wrap that doesn't account for words. So it will split a word in half. fmt
on Linux has a -s argument that tells it not to split lines shorter than the maximum. It operates exactly how I would hope.On FreeBSD, -s is a whitespace collapsing argument. If -s wasn't used on FreeBSD, I'd be tempted to rewrite the feature and just use -s. I could still do it with a different argument name, although not certain which one.
Is there another utility which does this? Maybe something in Ports? If I did write a patch for FreeBSD's
fmt
, do you think it would be accepted? What should the argument name be? Or should I write something new altogether?Thank you for your time.