Skip to content

Commit ffd3ccd

Browse files
committed
hugo: use render hook for markdown tables
Signed-off-by: David Karlsson <[email protected]>
1 parent 4079419 commit ffd3ccd

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

assets/css/typography.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,5 @@
7373
@apply text-lg;
7474
line-height: 1.75;
7575
}
76-
table {
77-
display: block;
78-
overflow-x: auto;
79-
max-width: 100%;
80-
}
8176
}
8277
}

hugo_stats.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
"bg-gradient-to-br",
156156
"bg-gradient-to-r",
157157
"bg-gradient-to-t",
158+
"bg-gray-dark-200",
158159
"bg-gray-light-100",
159160
"bg-gray-light-200",
160161
"bg-gray-light-400",
@@ -416,6 +417,7 @@
416417
"outline-none",
417418
"overflow-clip",
418419
"overflow-hidden",
420+
"overflow-x-auto",
419421
"overflow-x-hidden",
420422
"overflow-y-auto",
421423
"p-1",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<div class="overflow-x-auto">
2+
<table
3+
{{- range $k, $v := .Attributes }}
4+
{{- if $v }}
5+
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
6+
{{- end }}
7+
{{- end }}>
8+
<thead class="bg-gray-light-100 dark:bg-gray-dark-200">
9+
{{- range .THead }}
10+
<tr>
11+
{{- range . }}
12+
<th class="p-2"
13+
{{- with .Alignment }}
14+
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
15+
{{- end -}}
16+
>
17+
{{- .Text -}}
18+
</th>
19+
{{- end }}
20+
</tr>
21+
{{- end }}
22+
</thead>
23+
<tbody>
24+
{{- range .TBody }}
25+
<tr>
26+
{{- range . }}
27+
<td class="p-2"
28+
{{- with .Alignment }}
29+
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
30+
{{- end -}}
31+
>
32+
{{- .Text -}}
33+
</td>
34+
{{- end }}
35+
</tr>
36+
{{- end }}
37+
</tbody>
38+
</table>
39+
</div>

0 commit comments

Comments
 (0)