mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-11-17 05:15:58 -06:00
Add table formatting, requires using custom "table" shortcode
This commit is contained in:
parent
f4c056b99c
commit
5ffca36b84
@ -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;
|
||||
}
|
||||
|
10
layouts/shortcodes/table.html
Normal file
10
layouts/shortcodes/table.html
Normal file
@ -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 `<table class="%s">` $class }}
|
||||
{{ (replace $htmlTable "<table>" $new) | safeHTML }}
|
Loading…
Reference in New Issue
Block a user