Skip to content

multi-line header titles #5

@Ramblurr

Description

@Ramblurr

In some cases when the contents of a header is much longer than the values in that column, it would be nice to format the header over multiple lines to reduce the overall width of the columns.

(println
 (t/table [{:name :a :title "An Extra Long Title" :align :right}] [{:a 1} {:a 2} {:a 3}]))

Current output

|---------------------|
| An Extra Long Title |
|---------------------|
|                   1 |
|                   2 |
|                   3 |
|---------------------|

Desired (example)


|------------|
|  An Extra  |
| Long Title |
|------------|
|          1 |
|          2 |
|          3 |
|------------|

Note that in this example, the header is wrapped but also centered (which could be added with a new option :header-align :center.

In my use case I don't need doric to auto wrap, rather when I supply a header with a \n, doric should assume that implies wrapping is desired. Currently if you add a \n in the title, you get:

|---------------------|
| An Extra
Long Title |
|---------------------|
|                   1 |
|                   2 |
|                   3 |
|---------------------|

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions