Create table shortcode that allows for table captions (#13117)

* Create table shortcode for captions

* Allow for tables without captions

* Add table documentation in shortcodes guide

* Docs cleanup
This commit is contained in:
Luc Perkins
2019-04-09 22:20:12 -07:00
committed by Kubernetes Prow Robot
parent 6391d2b3cd
commit 645d3d8ded
2 changed files with 43 additions and 3 deletions
+6
View File
@@ -0,0 +1,6 @@
{{ $hasCaption := isset .Params "caption" }}
{{ $caption := .Get "caption" }}
{{ $captionEl := printf "<table><caption style=\"display: none;\">%s</caption>" $caption }}
{{ $table := .Inner | markdownify }}
{{ $html := cond $hasCaption ($table | replaceRE "<table>" $captionEl) $table | safeHTML }}
{{ $html }}