mirror of
https://github.com/Hopiu/bootstrap.git
synced 2026-04-16 18:40:59 +00:00
Create a new table shortcode so we can easily add Bootstrap table classes to Markdown tables
This commit is contained in:
parent
0408799ae5
commit
85ac2fc35e
1 changed files with 11 additions and 0 deletions
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 }}
|
||||
Loading…
Reference in a new issue