markup/goldmark: Change default cell alignment in table render hook

Change the default table cell alignment from "left" to an empty string.

Closes #12886
This commit is contained in:
Joe Mooring
2024-09-28 12:06:09 -07:00
committed by Bjørn Erik Pedersen
parent d1ba52f3c3
commit 1158e63072
3 changed files with 14 additions and 6 deletions

View File

@@ -8,7 +8,11 @@
{{- range .THead }}
<tr>
{{- range . }}
<th {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
<th
{{- with .Alignment }}
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
{{- end -}}
>
{{- .Text -}}
</th>
{{- end }}
@@ -19,7 +23,11 @@
{{- range .TBody }}
<tr>
{{- range . }}
<td {{ printf "style=%q" (printf "text-align: %s" .Alignment) | safeHTMLAttr }}>
<td
{{- with .Alignment }}
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
{{- end -}}
>
{{- .Text -}}
</td>
{{- end }}