Update table render hook example

See https://github.com/gohugoio/hugo/pull/12889
This commit is contained in:
Joe Mooring 2024-09-29 16:12:59 -07:00 committed by GitHub
parent efbee0bff8
commit cb3cb504c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -82,7 +82,11 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
{{- range .THead }} {{- range .THead }}
<tr> <tr>
{{- range . }} {{- range . }}
<th {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}> <th
{{- with .Alignment }}
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
{{- end -}}
>
{{- .Text -}} {{- .Text -}}
</th> </th>
{{- end }} {{- end }}
@ -93,7 +97,11 @@ In its default configuration, Hugo renders Markdown tables according to the [Git
{{- range .TBody }} {{- range .TBody }}
<tr> <tr>
{{- range . }} {{- range . }}
<td {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}> <td
{{- with .Alignment }}
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
{{- end -}}
>
{{- .Text -}} {{- .Text -}}
</td> </td>
{{- end }} {{- end }}