diff options
| author | Mark Otto <[email protected]> | 2020-04-13 17:53:06 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2020-04-26 17:26:04 -0700 |
| commit | 85ac2fc35e60c430d5ba0342e584ba0a9b5b916e (patch) | |
| tree | 287e43fdaa76e471e72a3544242d98d23ae1e6a3 | |
| parent | 0408799ae5ddad0ea8d441bca6de5d5bbb730e16 (diff) | |
| download | bootstrap-85ac2fc35e60c430d5ba0342e584ba0a9b5b916e.tar.xz bootstrap-85ac2fc35e60c430d5ba0342e584ba0a9b5b916e.zip | |
Create a new table shortcode so we can easily add Bootstrap table classes to Markdown tables
| -rw-r--r-- | site/layouts/shortcodes/bs-table.html | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/site/layouts/shortcodes/bs-table.html b/site/layouts/shortcodes/bs-table.html new file mode 100644 index 000000000..6f972d665 --- /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 := "<table>" }} +{{ $new := printf "<table class=\"%s\">" $css_class }} +{{ $htmlTable := replace $htmlTable $old $new }} +{{ $htmlTable | safeHTML }} |
