thephpleague / climate

PHP's best friend for the terminal.
http://climate.thephpleague.com
MIT License
1.87k stars 123 forks source link

Newlines in table data #159

Closed torohill closed 3 years ago

torohill commented 4 years ago

If there are newlines in the table data these cause the layout to break. For example:

$climate->table([
    ['foo'=>"bar\nbar", 'baz'=>'foobaz'],
    ['foo'=>'bar', 'baz'=>'foobar'],
]);

--------------------
| foo     | baz    |
====================
| bar
bar | foobaz |
--------------------
| bar     | foobar |
--------------------

What do you think about adding an option to format newlines so the table looks like this?

----------------
| foo | baz    |
================
| bar | foobaz |
| bar |        |
----------------
| bar | foobar |
----------------
duncan3dc commented 4 years ago

Sounds like a good idea (although rather than an option I'd expect that to just be standard behaviour), not sure how difficult/practical it will be though, will take a look in the next week

duncan3dc commented 3 years ago

This is fixed in 3.6.0 thanks for the code!