]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Create a new table shortcode so we can easily add Bootstrap table classes to Markdown...
authorMark Otto <markdotto@gmail.com>
Tue, 14 Apr 2020 00:53:06 +0000 (17:53 -0700)
committerMark Otto <otto@github.com>
Mon, 27 Apr 2020 00:26:04 +0000 (17:26 -0700)
site/layouts/shortcodes/bs-table.html [new file with mode: 0644]

diff --git a/site/layouts/shortcodes/bs-table.html b/site/layouts/shortcodes/bs-table.html
new file mode 100644 (file)
index 0000000..6f972d6
--- /dev/null
@@ -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 }}