File tree Expand file tree Collapse file tree 4 files changed +66
-4
lines changed Expand file tree Collapse file tree 4 files changed +66
-4
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ the second column will be three times as wide as the first column.
120
120
121
121
<!-- no demo because GFM does not support inline CSS -->
122
122
123
- ## Header rows
123
+ ## Header rows & columns
124
124
125
125
You can configure how many rows are part of the table head
126
126
with the ` header-rows ` attribute (which defaults to 1).
@@ -149,3 +149,40 @@ results in:
149
149
</tr >
150
150
</tbody >
151
151
</table >
152
+
153
+ The same also works for ` header-cols ` (which however defaults to 0).
154
+ For example:
155
+
156
+ ```
157
+ :::{.list-table header-cols=1}
158
+ * - Name
159
+ - Initial release
160
+
161
+ * - Markdown
162
+ - 2004
163
+
164
+ * - reStructuredText
165
+ - 2002
166
+ :::
167
+ ```
168
+
169
+ results in:
170
+
171
+ <table >
172
+ <thead >
173
+ <tr >
174
+ <th >Name</th >
175
+ <th >Initial release</th >
176
+ </tr >
177
+ </thead >
178
+ <tbody >
179
+ <tr >
180
+ <th >Markdown</th >
181
+ <td >2004</td >
182
+ </tr >
183
+ <tr >
184
+ <th >reStructuredText</th >
185
+ <td >2002</td >
186
+ </tr >
187
+ </tbody >
188
+ </table >
Original file line number Diff line number Diff line change 58
58
</ tr >
59
59
</ tbody >
60
60
</ table >
61
+ < table >
62
+ < thead >
63
+ < tr class ="header ">
64
+ < th > row 1, column 1</ th >
65
+ < th > row 1, column 2</ th >
66
+ </ tr >
67
+ </ thead >
68
+ < tbody >
69
+ < tr class ="odd ">
70
+ < th > row 2, column 1</ th >
71
+ < td > row 2, column 2</ td >
72
+ </ tr >
73
+ </ tbody >
74
+ </ table >
Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ local function new_table_head(rows)
52
52
return {{}, rows }
53
53
end
54
54
55
- local function new_table_body (rows )
55
+ local function new_table_body (rows , header_col_count )
56
56
return {
57
57
attr = {},
58
58
body = rows ,
59
59
head = {},
60
- row_head_columns = 0
60
+ row_head_columns = header_col_count
61
61
}
62
62
end
63
63
@@ -107,6 +107,9 @@ local function process(div)
107
107
local header_row_count = tonumber (div .attr .attributes [' header-rows' ]) or 1
108
108
div .attr .attributes [' header-rows' ] = nil
109
109
110
+ local header_col_count = tonumber (div .attr .attributes [' header-cols' ]) or 0
111
+ div .attr .attributes [' header-cols' ] = nil
112
+
110
113
local colspecs = get_colspecs (div .attr .attributes , # rows [1 ][2 ])
111
114
local thead_rows = {}
112
115
for i = 1 , header_row_count do
@@ -118,7 +121,7 @@ local function process(div)
118
121
{long = caption , short = {}},
119
122
colspecs ,
120
123
new_table_head (thead_rows ),
121
- {new_table_body (rows )},
124
+ {new_table_body (rows , header_col_count )},
122
125
table_foot ,
123
126
div .attr
124
127
)
Original file line number Diff line number Diff line change 33
33
* - row 2, column 1
34
34
- row 2, column 2
35
35
:::
36
+
37
+ :::{.list-table header-cols=1}
38
+ * - row 1, column 1
39
+ - row 1, column 2
40
+
41
+ * - row 2, column 1
42
+ - row 2, column 2
43
+ :::
You can’t perform that action at this time.
0 commit comments