File tree Expand file tree Collapse file tree 4 files changed +56
-1
lines changed Expand file tree Collapse file tree 4 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -119,3 +119,33 @@ For example when we change the first line of the previous example to:
119
119
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
+
123
+ ## Header rows
124
+
125
+ You can configure how many rows are part of the table head
126
+ with the ` header-rows ` attribute (which defaults to 1).
127
+
128
+ ```
129
+ :::{.list-table header-rows=0}
130
+ * - row 1, column 1
131
+ - row 1, column 2
132
+
133
+ * - row 2, column 1
134
+ - row 2, column 2
135
+ :::
136
+ ```
137
+
138
+ results in:
139
+
140
+ <table >
141
+ <tbody >
142
+ <tr >
143
+ <td >row 1, column 1</td >
144
+ <td >row 1, column 2</td >
145
+ </tr >
146
+ <tr >
147
+ <td >row 2, column 1</td >
148
+ <td >row 2, column 2</td >
149
+ </tr >
150
+ </tbody >
151
+ </table >
Original file line number Diff line number Diff line change 46
46
</ tr >
47
47
</ tbody >
48
48
</ table >
49
+ < table >
50
+ < tbody >
51
+ < tr class ="odd ">
52
+ < td > row 1, column 1</ td >
53
+ < td > row 1, column 2</ td >
54
+ </ tr >
55
+ < tr class ="even ">
56
+ < td > row 2, column 1</ td >
57
+ < td > row 2, column 2</ td >
58
+ </ tr >
59
+ </ tbody >
60
+ </ table >
Original file line number Diff line number Diff line change @@ -104,8 +104,14 @@ local function process(div)
104
104
table.insert (rows , row )
105
105
end
106
106
107
+ local header_row_count = tonumber (div .attr .attributes [' header-rows' ]) or 1
108
+ div .attr .attributes [' header-rows' ] = nil
109
+
107
110
local colspecs = get_colspecs (div .attr .attributes , # rows [1 ][2 ])
108
- local thead_rows = {table.remove (rows , 1 )}
111
+ local thead_rows = {}
112
+ for i = 1 , header_row_count do
113
+ table.insert (thead_rows , table.remove (rows , 1 ))
114
+ end
109
115
110
116
local table_foot = {{}, {}};
111
117
return pandoc .Table (
Original file line number Diff line number Diff line change 26
26
- row 3, column 2
27
27
:::
28
28
29
+ :::{.list-table header-rows=0}
30
+ * - row 1, column 1
31
+ - row 1, column 2
32
+
33
+ * - row 2, column 1
34
+ - row 2, column 2
35
+ :::
You can’t perform that action at this time.
0 commit comments