Skip to content

Commit 5db510b

Browse files
committed
render-table improvement
1 parent 56ce7a2 commit 5db510b

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

docs/_data/tables/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
getting-started:
22
headers:
3-
step: Intitial steps
3+
step: Initial steps
44
documentation: Documentation
55
advanced-topics: Advanced topics
66
body:

docs/_includes/render-table.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
{%- for cell in include.table.headers -%}
5050
{%- assign columnId = cell[0] -%}
5151
{%- unless columnId == "_attributes" or table-omit-columns contains columnId or row[columnId] == "$skip" -%}
52-
<td markdown="1" {% for attribute in row._attributes[columnId] %} {{ attribute[0] }}="{{ attribute[1] }}" {% endfor %} >
52+
<td markdown="1" data-label="{{
53+
include.table.headers[columnId]
54+
}}" {% for attribute in row._attributes[columnId] %} {{ attribute[0] }}="{{ attribute[1] }}" {% endfor %} >
5355
{{ row[columnId] }}
5456
</td>
5557
{%- endunless -%}

docs/assets/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ document.addEventListener('DOMContentLoaded', function() {
101101
for (var r = 0; r<rows.length; r++) {
102102
var cells = rows[r].querySelectorAll('td');
103103
for (var c = 0; c<headers.length; c++) {
104-
if (c < cells.length) {
104+
if (c < cells.length && !cells[c].dataset.label) { // yaml tables generated by render-table.html already have data-labels. don't override, they know better, e.g. in case of rowspans)
105105
cells[c].dataset.label = headers[c].innerText;
106106
}
107107
}

0 commit comments

Comments
 (0)