0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-18 15:54:26 +01:00

Create a new table shortcode so we can easily add Bootstrap table classes to Markdown tables

This commit is contained in:
Mark Otto 2020-04-13 17:53:06 -07:00 committed by Mark Otto
parent 0408799ae5
commit 85ac2fc35e

View 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 }}