Replace table shortcode with markdown attributes for class

This commit is contained in:
BBaoVanC 2024-11-15 17:25:46 -06:00
parent ddb57e0120
commit c9095e948b
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
3 changed files with 13 additions and 17 deletions

View File

@ -248,31 +248,31 @@ hr {
} }
} }
table.markdown { table.simple {
border-collapse: collapse; border-collapse: collapse;
border: 2px solid var(--text-1); border: 2px solid var(--text-1);
} }
table.markdown thead { table.simple thead {
background-color: var(--background-2); background-color: var(--background-2);
color: var(--text-2); color: var(--text-2);
border-bottom: 2px solid var(--text-1); border-bottom: 2px solid var(--text-1);
} }
table.markdown th, table.simple th,
table.markdown td { table.simple td {
padding: 8px; padding: 8px;
} }
table.markdown :is(th, td) + :is(th, td) { table.simple :is(th, td) + :is(th, td) {
border-left: 2px solid var(--text-1); border-left: 2px solid var(--text-1);
} }
table.markdown tbody tr:nth-child(odd) { table.simple tbody tr:nth-child(odd) {
background-color: var(--background-0); background-color: var(--background-0);
color: var(--text-0); color: var(--text-0);
} }
table.markdown tbody tr:nth-child(even) { table.simple tbody tr:nth-child(even) {
background-color: var(--background-1); background-color: var(--background-1);
color: var(--text-1); color: var(--text-1);
} }

View File

@ -2,6 +2,12 @@ markup:
highlight: highlight:
noClasses: false noClasses: false
lineNos: true lineNos: true
goldmark:
parser:
attribute:
block: true
# this is enabled by default already
#title: true
params: params:
readingtime: true readingtime: true

View File

@ -1,10 +0,0 @@
{{/* See https://willschenk.com/articles/2020/styling_tables_with_hugo/ */}}
{{ $class := "markdown" }}
{{ with .Get "class" }}
{{ $class = delimit (slice $class .) " " }}
{{ end }}
{{ $htmlTable := .Inner | .Page.RenderString (dict "display" "block") }}
{{ $new := printf `<table class="%s">` $class }}
{{ (replace $htmlTable "<table>" $new) | safeHTML }}