diff --git a/assets/css/bobastyle.css b/assets/css/bobastyle.css index 45358b5..5e3cb0e 100644 --- a/assets/css/bobastyle.css +++ b/assets/css/bobastyle.css @@ -436,6 +436,27 @@ hr { border-color: var(--background-5); } +table.markdown { + border-collapse: collapse; + border: 2px solid var(--text-normal); +} + +.markdown thead { + background-color: var(--background-4); +} + +.markdown th, +.markdown td { + padding: 8px; +} + +.markdown tbody tr:nth-child(odd) { + background-color: var(--background); +} +.markdown tbody tr:nth-child(even) { + background-color: var(--background-2); +} + * { box-sizing: border-box; } diff --git a/layouts/shortcodes/table.html b/layouts/shortcodes/table.html new file mode 100644 index 0000000..3a43ab0 --- /dev/null +++ b/layouts/shortcodes/table.html @@ -0,0 +1,10 @@ +{{/* See https://willschenk.com/articles/2020/styling_tables_with_hugo/ */}} + +{{ $class := "markdown" }} +{{ with .Get "class" }} + {{ $class = delimit (slice $class .) " " }} +{{ end }} + +{{ $htmlTable := .Inner | markdownify }} +{{ $new := printf `