Print strings with newlines and indentation
ljcui opened this issue · comments
The code is
std::string str = R"(first line
second line
third line)";
std::cout << str << std::endl;
tabulate::Table table;
table.add_row({str});
std::cout << table << std::endl;
The output is
first line
second line
third line
+--------------------+
| first line |
| second line |
| third line |
+--------------------+
Why indented strings disappear ?
Per the note in this section of the README:
NOTE: Whether word-wrapping is automatic or not, tabulate performs a trim operation on each line of each cell to remove whitespace characters from either side of line.
tabulate
performs a trim operation. This is why the indentation disappears. This is by design.
Per the note in this section of the README:
NOTE: Whether word-wrapping is automatic or not, tabulate performs a trim operation on each line of each cell to remove whitespace characters from either side of line.
tabulate
performs a trim operation. This is why the indentation disappears. This is by design.
I don't think this is a correct design because it modifies the original string content.
I found this PR:#109, this is I need. Expect a new release that includes this pr.
Yes, I will create a new release soon.