Create 'table' shortcode

Create shortcode to allow pages to provide CSS classes to apply to the
HTML table generated from a Markdown table.

Add some basic CSS styling for the table, to provide padding to make the
data easier to read.

Add a 'table-bordered' style to add borders to the table rows/columns.
master v0.1.4
Kevin C. Coram 2020-11-07 15:32:40 -05:00
ebeveyn 0d75e505db
işleme 8c5110ddda
İmzalayan: kevin
GPG Anahtar Kimliği: 0E64ECB9EDE572A3
2 değiştirilmiş dosya ile 20 ekleme ve 1 silme

Dosyayı Görüntüle

@ -0,0 +1,6 @@
{{ $htmlTable := .Inner | markdownify }}
{{ $class := .Get 0 }}
{{ $old := "<table>" }}
{{ $new := printf "<table class=\"%s\">" $class }}
{{ $htmlTable := replace $htmlTable $old $new }}
{{ $htmlTable | safeHTML }}

Dosyayı Görüntüle

@ -99,4 +99,17 @@ figure img {
figure img {
max-width: calc(100vw - 510px);
}
}
}
/* Styes for tables */
table, th, td {
padding: 0.5rem;
}
table.table-bordered,
table.table-bordered td,
table.table-bordered th {
border: 1px solid #dee2e6;
border-spacing: 2px;
border-collapse: collapse;
}