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
parent
0d75e505db
commit
8c5110ddda
|
@ -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 }}
|
|
@ -99,4 +99,17 @@ figure img {
|
||||||
figure img {
|
figure img {
|
||||||
max-width: calc(100vw - 510px);
|
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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue