From 85ac2fc35e60c430d5ba0342e584ba0a9b5b916e Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Mon, 13 Apr 2020 17:53:06 -0700 Subject: [PATCH] Create a new table shortcode so we can easily add Bootstrap table classes to Markdown tables --- site/layouts/shortcodes/bs-table.html | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 site/layouts/shortcodes/bs-table.html diff --git a/site/layouts/shortcodes/bs-table.html b/site/layouts/shortcodes/bs-table.html new file mode 100644 index 0000000000..6f972d6651 --- /dev/null +++ b/site/layouts/shortcodes/bs-table.html @@ -0,0 +1,11 @@ +{{- /* + Usage: `table "class"`, + where class can be anything +*/ -}} + +{{ $htmlTable := .Inner | markdownify }} +{{ $css_class := .Get 0 | default "table" }} +{{ $old := "" }} +{{ $new := printf "
" $css_class }} +{{ $htmlTable := replace $htmlTable $old $new }} +{{ $htmlTable | safeHTML }}