columnify icon indicating copy to clipboard operation
columnify copied to clipboard

Preserve whitespace by default?

Open rauchg opened this issue 9 years ago • 6 comments

https://github.com/timoxley/columnify/blob/master/index.js#L89

Why does it collapse whitespace other than newlines?

rauchg avatar Feb 13 '16 06:02 rauchg

Once I got rid of that option in my local copy, I also traced whitespace trimming to: https://github.com/timoxley/columnify/blob/master/utils.js#L83

rauchg avatar Feb 13 '16 06:02 rauchg

Why does it collapse whitespace other than newlines?

Does it by default because it's trying to format dirty data as prettily as possible, Though I think I have been bitten by this before, trying to display some data that was pre-formatted.

Can you elaborate on your use-case?

timoxley avatar Feb 13 '16 10:02 timoxley

@timoxley displaying pre-formatted data, where leading whitespace is relevant

rauchg avatar Feb 13 '16 18:02 rauchg

This would be great to allow a preserveWhitespace option!

brandoncarl avatar Feb 22 '16 23:02 brandoncarl

Agreed, whitespace is a must for pre-formatted tables.

nikolakanacki avatar May 10 '16 03:05 nikolakanacki

If no one is working on this, I can try to do a preserveWhitespace option.

runvnc avatar Jul 04 '16 20:07 runvnc