mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-17 19:06:40 +02:00
Create a new table shortcode so we can easily add Bootstrap table classes to Markdown tables
This commit is contained in:
11
site/layouts/shortcodes/bs-table.html
Normal file
11
site/layouts/shortcodes/bs-table.html
Normal file
@@ -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 }}
|
Reference in New Issue
Block a user