@@ -37,11 +37,13 @@ tablemark([
37
37
38
38
... displays as:
39
39
40
+ <!-- prettier-ignore-start -->
40
41
| Name | Age | Is cool |
41
42
| :---- | :---- | :------ |
42
43
| Bob | 21 | false |
43
44
| Sarah | 22 | true |
44
45
| Lee | 23 | true |
46
+ <!-- prettier-ignore-end -->
45
47
46
48
## api
47
49
@@ -55,14 +57,15 @@ tablemark (input: InputData, options?: TablemarkOptions): string
55
57
* an array of objects or iterables
56
58
* ` TablemarkOptions ` options:
57
59
58
- | key | type | default | description |
59
- | :------------: | :----------: | :--------: | ---------------------------------------------- |
60
- | ` columns ` | ` Array<string \| ColumnDescriptor> ` | - | Array of column descriptors. |
61
- | ` caseHeaders ` | ` boolean ` | ` true ` | Sentence case headers derived from keys. |
62
- | ` toCellText ` | ` (input: unknown) => string ` | - | Provide a custom "toString" function. |
63
- | ` wrapWidth ` | ` number ` | ` Infinity ` | Wrap cell text at this length. |
64
- | ` wrapWithGutters ` | ` boolean ` | ` false ` | Add sides (` \| <content> \| ` ) to wrapped rows. |
65
- | ` lineEnding ` | ` string ` | ` "\n" ` | String used at end-of-line. |
60
+ | key | type | default | description |
61
+ | :------------------: | :---------------------------------: | :--------: | --------------------------------------------------------------- |
62
+ | ` columns ` | ` Array<string \| ColumnDescriptor> ` | - | Array of column descriptors. |
63
+ | ` caseHeaders ` | ` boolean ` | ` true ` | Sentence case headers derived from keys. |
64
+ | ` toCellText ` | ` (input: unknown) => string ` | - | Provide a custom "toString" function. |
65
+ | ` padHeaderSeparator ` | ` boolean ` | ` true ` | Whether to pad gutters of the header separator (alignment) row. |
66
+ | ` wrapWidth ` | ` number ` | ` Infinity ` | Wrap cell text at this length. |
67
+ | ` wrapWithGutters ` | ` boolean ` | ` false ` | Add sides (` \| <content> \| ` ) to wrapped rows. |
68
+ | ` lineEnding ` | ` string ` | ` "\n" ` | String used at end-of-line. |
66
69
67
70
The ` columns ` array can either contain objects, in which case their
68
71
` name ` and ` align ` properties will be used to alter the display of
@@ -103,11 +106,44 @@ tablemark([
103
106
104
107
... displays as:
105
108
109
+ <!-- prettier-ignore-start -->
106
110
| first name | how old | are they cool |
107
111
| :--------- | :-----: | :------------ |
108
112
| Bob | 21 | false |
109
113
| Sarah | 22 | true |
110
114
| Lee | 23 | true |
115
+ <!-- prettier-ignore-end -->
116
+
117
+ ### ` options.padHeaderSeparator `
118
+
119
+ ``` js
120
+ tablemark (
121
+ [
122
+ { name: " Bob" , age: 21 , isCool: false },
123
+ { name: " Sarah" , age: 22 , isCool: true },
124
+ { name: " Lee" , age: 23 , isCool: true }
125
+ ],
126
+ {
127
+ columns: [{ align: " left" }, { align: " center" }, { align: " right" }]
128
+ }
129
+ )
130
+
131
+ // | first name | how old | are they cool |
132
+ // |:-----------|:-------:|--------------:|
133
+ // | Bob | 21 | false |
134
+ // | Sarah | 22 | true |
135
+ // | Lee | 23 | true |
136
+ ```
137
+
138
+ ... displays as:
139
+
140
+ <!-- prettier-ignore-start -->
141
+ | first name | how old | are they cool |
142
+ | :-----------| :-------:| --------------:|
143
+ | Bob | 21 | false |
144
+ | Sarah | 22 | true |
145
+ | Lee | 23 | true |
146
+ <!-- prettier-ignore-end -->
111
147
112
148
### ` options.toCellText `
113
149
0 commit comments