From 0cf45362a59bd1c032fe639b423f5355936f6eef Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Mon, 5 Oct 2026 23:01:18 +0000 Subject: [PATCH] Scroll only content tables, not all tables Wrap Markdown and yamlToTable tables in a scrolling div instead of making every table block-level. Tables from other sources keep normal table layout: - FullCalendar grids, which collapse when tables are block-level. - Chroma code blocks with line numbers (lineNumbersInTable). - Raw HTML tables in site layouts, such as the scientific-python.org SPEC list. These no longer scroll on their own. Assisted-by: Claude Code:claude-opus-5-5 --- assets/theme-css/tables.css | 6 ++-- layouts/_default/_markup/render-table.html | 39 ++++++++++++++++++++++ layouts/shortcodes/yamlToTable.html | 2 ++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 layouts/_default/_markup/render-table.html diff --git a/assets/theme-css/tables.css b/assets/theme-css/tables.css index db49eb29..f2d46114 100644 --- a/assets/theme-css/tables.css +++ b/assets/theme-css/tables.css @@ -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; } diff --git a/layouts/_default/_markup/render-table.html b/layouts/_default/_markup/render-table.html new file mode 100644 index 00000000..50310a6b --- /dev/null +++ b/layouts/_default/_markup/render-table.html @@ -0,0 +1,39 @@ +
+ + + {{- range .THead }} + + {{- range . }} + + {{- end }} + + {{- end }} + + + {{- range .TBody }} + + {{- range . }} + + {{- end }} + + {{- end }} + +
+ {{- .Text -}} +
+ {{- .Text -}} +
+
diff --git a/layouts/shortcodes/yamlToTable.html b/layouts/shortcodes/yamlToTable.html index 0260cf76..0270c093 100644 --- a/layouts/shortcodes/yamlToTable.html +++ b/layouts/shortcodes/yamlToTable.html @@ -39,6 +39,7 @@ {{- $id := printf "id%03d" $.Ordinal -}} {{ with $data }} +
{{- with .caption -}} @@ -72,4 +73,5 @@ {{ end }}
{{ . }}#
+
{{ end }}