mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2025-06-12 17:57:28 -05:00
Add table formatting, requires using custom "table" shortcode
This commit is contained in:
10
layouts/shortcodes/table.html
Normal file
10
layouts/shortcodes/table.html
Normal file
@ -0,0 +1,10 @@
|
||||
{{/* See https://willschenk.com/articles/2020/styling_tables_with_hugo/ */}}
|
||||
|
||||
{{ $class := "markdown" }}
|
||||
{{ with .Get "class" }}
|
||||
{{ $class = delimit (slice $class .) " " }}
|
||||
{{ end }}
|
||||
|
||||
{{ $htmlTable := .Inner | markdownify }}
|
||||
{{ $new := printf `<table class="%s">` $class }}
|
||||
{{ (replace $htmlTable "<table>" $new) | safeHTML }}
|
Reference in New Issue
Block a user