Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions assets/theme-css/tables.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Make wide tables scroll on their own, since the content column does not. */
table {
display: block;
width: max-content;
/* Make wide content tables scroll on their own, since the content column does not. */
.table-wrapper {
max-width: 100%;
overflow-x: auto;
}
Expand Down
39 changes: 39 additions & 0 deletions layouts/_default/_markup/render-table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div class="table-wrapper">

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this just to render the table-wrapper; wondering if we can't reuse the Hugo internal renderer?

<table
{{- range $k, $v := .Attributes }}
{{- if $v }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end }}>
<thead>
{{- range .THead }}
<tr>
{{- range . }}
<th
{{- with .Alignment }}
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
{{- end -}}
>
{{- .Text -}}
</th>
{{- end }}
</tr>
{{- end }}
</thead>
<tbody>
{{- range .TBody }}
<tr>
{{- range . }}
<td
{{- with .Alignment }}
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
{{- end -}}
>
{{- .Text -}}
</td>
{{- end }}
</tr>
{{- end }}
</tbody>
</table>
</div>
2 changes: 2 additions & 0 deletions layouts/shortcodes/yamlToTable.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
{{- $id := printf "id%03d" $.Ordinal -}}

{{ with $data }}
<div class="table-wrapper">
<table class="table" id="{{ $id }}">
{{- with .caption -}}
<caption><span class="caption-text">{{ . }}</span><a class="headerlink" href="#{{ $id }}" title="Link to this table">#</a></caption>
Expand Down Expand Up @@ -72,4 +73,5 @@
{{ end }}

</table>
</div>
{{ end }}
Loading