diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-08-30 10:58:43 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-08-31 17:21:31 +0200 |
commit | f738669a4d09ca04619f4d0f89d90c9b414e9f2e (patch) | |
tree | 5e05f8a849d921dc4380ac8552fd90891331b04a /tpl | |
parent | b63f24adc78e09c1044b448daa7c6cb375cebee6 (diff) | |
download | hugo-f738669a4d09ca04619f4d0f89d90c9b414e9f2e.tar.gz hugo-f738669a4d09ca04619f4d0f89d90c9b414e9f2e.zip |
Add Markdown render hooks for tables
Fixes #9316
Fixes #12811
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/tplimpl/embedded/templates/_default/_markup/render-table.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tpl/tplimpl/embedded/templates/_default/_markup/render-table.html b/tpl/tplimpl/embedded/templates/_default/_markup/render-table.html new file mode 100644 index 000000000..307f0a5a3 --- /dev/null +++ b/tpl/tplimpl/embedded/templates/_default/_markup/render-table.html @@ -0,0 +1,29 @@ +<table + {{- range $k, $v := .Attributes }} + {{- if $v }} + {{- printf " %s=%q" $k $v | safeHTMLAttr }} + {{- end }} + {{- end }}> + <thead> + {{- range .THead }} + <tr> + {{- range . }} + <th {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}> + {{- .Text | safeHTML -}} + </th> + {{- end }} + </tr> + {{- end }} + </thead> + <tbody> + {{- range .TBody }} + <tr> + {{- range . }} + <td {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}> + {{- .Text | safeHTML -}} + </td> + {{- end }} + </tr> + {{- end }} + </tbody> +</table> |